i created an array in the frontend in angular that had schoolar centers from my database in mongoDB.The problem is when with a ngFor i try to iterate the array of centers.The userService takes the users from my api.
"Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays."
public centers: Center[];
constructor(
private _route: ActivatedRoute,
private _router: Router,
private _userService: UserService
){
this.user = new User("","","","","","","","","","","");
this.title = 'Registrate'
}
getCenters(){
this._userService.getCenters().subscribe(
//Se guardan los centros en un array para poder acceder a ellos desde la plantilla
response => {
this.centers = response;
},
err => {
console.log(err);
}
)
}
ngOnInit(){
this.getCenters();
}