Can someone explain why I am encountering the following issue:
ERROR TypeError: _this.user_data.apply is not a function
When attempting to populate user_data with data from a mapped JSON file
user_data: any;
this.testService.getTestWithObservable()
.map( result => result.map( i => i.users.data) )
.subscribe(
res => {
this.user_data = [];
res.forEach(i => this.user_data(...i));
console.log(this.user_data);
}
);
}
JSON
[{
"id": 1,
"users": {
"user_id": 14,
"data": [{
"name": "James",
"age": 20
},
{
"name": "Damien",
"age": 25
}]
}
}
{
"id": 2,
"users": {
"user_id": 11,
"data": [{
"name": "James",
"age": 20
},
{
"name": "Damien",
"age": 25
}]
}
}]
I have been unable to locate any information regarding this error in my code