Here is what I'm trying to do:
<select name=manager id=manager [(ngModel)]=property.manager class=form-control (change)=onChangeManager($event) required>
<option disabled value=>Select Manager</option>
<option *ngFor=let manager of managers [ngValue]=manager [selected]=manager?.name === 'Subhan Ahmed'>
{{manager?.name}}
</option>
</select>
What I need is when the view is initialised, I need to set the value of the select where manager?.name == property.manager.name
(which is loaded from db on on another event). I've tried to place a default text Subhan Ahmed
to select the default value but its not working.
Managers are loaded at the start, I load them from Firestore and assign them to a variable managers: Observable<Manager>;
during subscribe()
, while property.manager
is loaded after another input's change event.
Am i missing something?