Articles in this section
Category / Section

Accessing EJComponents class from ej-angular2 package

1 min read

Getting widget reference of Angular components

 

We can get widget reference of Syncfusion Angular components by using EJComponents class from ej-angular2 package and viewchild from @angular/core package.

 Define template reference and gets component instance as like below code snippet.

import { Component, ViewChild } from '@angular/core';

import { EJComponents } from 'ej-angular2';

 

@Component({

  selector: 'app-root',

  template: `<input #buttonref ej-button />`

})

export class AppComponent {

  @ViewChild('buttonref') buttonIns: EJComponents<any, any>;

 

  ngAfterViewInit() {

    console.log(this.buttonIns.model);

  }

}

 

NOTE: ViewChild will be set only after ngAfterViewInit event fired.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied