I'm unable to call the change()
event when the page gets loaded.
I would like to display 'NONE'
as a default text in ng-select drop-down
untill api data gets loaded; thus, the 'NONE'
value will be sent in request object while submitting its form. Anyhow, due to change
event not getting fired on page load, I'm unable to proceed further.
\<ng-select \[items\]="apidata | async" bindValue="name" bindLabel="name" #refOption
(change)="onChangeMethod()"\>
\</ng-select\>
Technical specifications of <ng-select> control
Note
I'm unable to call the change()
event when the page gets loaded.
I would like to display 'NONE'
as a default text in ng-select drop-down
untill api data gets loaded; thus, the 'NONE'
value will be sent in request object while submitting its form. Anyhow, due to change
event not getting fired on page load, I'm unable to proceed further.
\<ng-select \[items\]="apidata | async" bindValue="name" bindLabel="name" #refOption
(change)="onChangeMethod()"\>
\</ng-select\>
Technical specifications of <ng-select> control
Note
Call the method directly on ngOnInit.
ngOnInit() {
this.onChangeMethod(true)
}
onChangeMethod(onLoad =false) {
let param = '';
if (onLoad) {
param = 'none';
}
this.http.get(`/api?tedst=${param}`).subscribe()
}