0

Do we have anywhere code or way to use select2 with angular2 ? When i tried to run the jquery selector way in on ngAfterViewInit then it does not handle this very well. Please suggest the way to implement in angular2

I have been doing it like this.

export class AppComponent{
   locations:any;
   ngAfterViewInit(){
     $('select').select2();
   }
   ngOnInit(){
   .....callToService(p=>this.locations=p);
   }
}

As locations are getting binded asynchronously so options are not reflecting.

Kapil Garg
  • 3,100
  • 5
  • 19
  • 19

0 Answers0