I am trying to iterate over array but not able to do so (its an array under array). It gives an error:
TypeError: Cannot read property 'toUpperCase' of undefined ("
I am not using toUpperCase anywhere.
The typescript code is :
ngOnInit() {
this.data = [
{
'name': 'Task 1',
'to_do': ['ToDo1', 'ToDo2', 'ToDo3']
},
{
'name': 'Task 2',
'to_do': ['ToDo4', 'ToDo5', 'ToDo6']
}
];
}
The template code is:
<div class="col-md-12">
Create New Task: <input type="text" name="task" />
<ul>
<li *ngFor="let task of data; let i=index; let todo=task.to_do;">
<div>
{{ task.name }}
{{ todo }}
</div>
<div *ngFor="let do of todo">
<input type="text" name="to_do" value="{{ do }}" />
</div>
</li>
</ul>
</div>