How to have a default option using angular 2 ou plus ?


if you have a select and you want to set a default value using angular , Add a binding to the selected property, like this :

<option *ngFor="#workout of workouts" 
    [selected]=" == 'back'">{{}}</option>

Read also : How to click on html button from the type script file in Angular 2 ?

Laisser un commentaire