Answer the question
In order to leave comments, you need to log in
How to count the number of objects in an array?
Good afternoon. How to calculate the number? I need to count in an object the quiz
number of objects included in an arraytextCategory
ngOnInit() {
this.quizService.getData().subscribe((data: Response) => this.quiz=data.json());
this.countPages = this.quiz.textCategory.length; // не работает
{ "categoryID": 1,
"nameCategory": "Первая категория",
"textCategory":
[{"textId":1,
"textContent":"<h3>Первый</h3>"},
{"textId":2,
"textContent":"<h3>Второй</h3>"}]
}
RROR TypeError: Cannot read property 'textCategory' of undefined
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question