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
Post a Comment