У меня есть API (node.js) и угловой фронт. Поэтому я выполняю HTTP-запрос на бэкэнд и получаю обратно наблюдаемой, которую я затем хочу отобразить на экране.
{{ p.name }}
{{ p.description }}
Übungen: {{ p.exercises }}
< /code>
Соответствующая служба: < /p>
fetchAll(): Observable {
return this.http
.get(this.url, { responseType: "json" })
.pipe(
catchError(this.errorHandlerService.handleError("fetchAll"))
);
}
< /code>
Но каким -то образом я получаю следующую ошибку: < /p>
ERROR RuntimeError: NG02200: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables, such as Arrays. Did you mean to use the keyvalue pipe? Find more at
Что мне не хватает?
edit:
{
"plans": [
{
"id": 1,
"name": "Plan 1",
"description": "Super lange Text",
"image": "assets/workout_15620186.png",
"exercises": 11
},
{
"id": 2,
"name": "Plan 2",
"description": "Super lange Text",
"image": "assets/workout_15620186.png",
"exercises": 1
},
{
"id": 3,
"name": "Plan 3",
"description": "Super lange Text",
"image": "assets/workout_15620186.png",
"exercises": 1
}
]
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... able-array