I am using [(ngModel)] as a whole object. And this works fine when I do from scratch, but not when I use it in edit mode. So when, for example when I assign the ngModel via some other function, the select dropdown's view doesn't update.
Here's how my HTML looks.
<select
class="form-control"
[(ngModel)]="selectedContentType"
[attr.disabled]="hideCollectionandContentType || hideContentTypeOnly ? '' : null"
required
(change)="contentTypeChanged(selectedContentType)">
<option [ngValue]="undefined">
Select Content Type
</option>
<option
*ngFor="let c of contentTypes"
[ngValue]="c">
{{c.value}}
</option>
</select>
The json for contentTypes looks like this format for each object.
{ key: '', value: ''}
For example, I am reading an existing form, which is supposed to display data coming from an API. I am setting the data back like this.
const selectedContentType = JSON.parse(res.BulkUpdate_SelectedContentType);
this.selectedContentType = { key: selectedContentType.ContentTypeId, value: selectedContentType.ContentTypeName };
Its setting in the right format, but the select dropdown is not updating.