I am encountering some issues with linking my data to ngModel.
Check out the data and code example below:
data = {
"id": 0,
"name": "",
"subitem": {
"subName": "",
}
};
When I use:
[(ngModel)]="data.name"
it works fine without any errors. However, when I try to access the subName field like this:
[(ngModel)]="data.subitem.subName"
or like this:
[(ngModel)]="data.subitem[0].subName"
I receive an error message saying:
Cannot read property .. of undefined
How can I successfully access subName?