angular - PrimeNg selectButton: how to display one as selected -


i have array of primeng selectbuttons , need show first 1 pressed. not finding guidance on that. know of api this?

you need initialize value of ngmodel [(ngmodel)]="selectedcity"

@component({   selector: 'my-app',   template: '<p-selectbutton [options]="cities" [(ngmodel)]="selectedcity"></p-selectbutton>' }) export class appcomponent {      selectedcity = 'london';      cities: any[];      ngoninit() {          this.cities = [                             {label:'london', value:'london'},             {label:'istanbul', value:'istanbul'},             {label:'paris', value:'paris'}         ]     } } 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -