I have a select field as follows:
<select class="form-control" [(ngModel)]="myClient.address && myClient.address.state" name="state" (ngModelChange)="getCitiesByState($event)">
<option class="form-control" *ngFor="let state of states"
[ngValue]="state">
{{state.name}}</option>
</select>
However, as I'm reusing the same component, I would like my option to be set to a value if my ngModel
has a value. For example, if myClient.address
has myClient.address = {"name":"Texas", "stateId":"2"}
, I want Texas to be the selected option.
How do I achieve this?