Setting an object as ngModel



I’m writing an application that has a dynamic list of items (ion-items).

    <ion-item *ngFor="let category of categoryList; let i = index;">
       <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>

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?


[ngModel] => One way binding
[(ngModel)] => Two way binding

change [ngModel] => to => [(ngModel)]