I have an array of PrimeNg selectButtons and need to show the first one as pressed. Not finding any guidance on that. Anyone know of the API to do this?
You just need to initialize the 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'}
]
}
}