Hi!
I’m writing an application that has a dynamic list of items (ion-items).
<ion-list>
<ion-item *ngFor="let category of categoryList; let i = index;">
<ion-label>{{categoryList[i]['category']}}</ion-label>
<ion-select [ngModel]="categoryList[i]['class_id']" name="mappingList" multiple="false">
<ion-option *ngFor="let class of classList" [value]="class.classID">{{ class['className'] }}</ion-option>
</ion-select>
</ion-item>
</ion-list>
When selecting an option within the select element, this value is not passed onto the ngModel (categoryList[i][‘class_id’]. The categoryList object is defined like this in the typescript file
categoryList: any = [];
,
and is populated with these objects:
var categoryInstance = { category_id: '', parent_id: '', category: '', class_id: '' }.
classList definition and population (each instance contains data):
classList: any = [];
var classInstance = {
classID: '', className: ''
};
Why is the ngModel not populated?