Angular2, in my ts, I have a control group, how can I have the two-way binding for the select in my html using ngFormControl?
form.component.ts
this._reportGeneratingForm = fb.group({
......
selectedGroup: ['']
})
form.component.html
<select class="form-control" ????>
<option>Day</option>
<option>Hour</option>
<option>week</option>
<option>Month</option>
</select>
<select class="form-control" [(ngModel)]="someProperty">
<option>Day</option>
<option>Hour</option>
<option>week</option>
<option>Month</option>
</select>
where someProperty
is a property on the components class that holds the value or
<select class="form-control" [ngFormControl]="selectControl">
<option>Day</option>
<option>Hour</option>
<option>week</option>
<option>Month</option>
</select>
This only works properly on all browsers if you have a recent Angular2 version (>= beta.16)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With