Articles in this section
Category / Section

Accessing EJComponents class from ej-angular2 package

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)
Access denied
Access denied