I am using PrimeNG in my angular5 app. I have issue with p-dropdown
Question
I have p-dropdown for showing countries. I bind the select opti
I use this solution to fix this
html:
ts:
public country;
public countries;
ngOnInit() {
this.applicant.country = 'India';
this.getCountry().then(()=>{
this.country = this.applicant.country
})
}
getCountry(){
return new Promise( (resolve,reject) => {
this.UserService.getallcountries().subscribe(result => {
this.cnt.forEach(element => {
this.countries.push({
label: element.name,
value: element.id
});
});
resolve();
}, error =>{
reject();
});
})
}
changeCountry(){
this.country = this.applicant.country;
}
it work at primeng 6.1.3