Answer the question
In order to leave comments, you need to log in
How to iterate over an object with arrays in Angular?
I would like to iterate over the objects:
Без группы: Array(3)
0: {ID: "21", NAME: "Ксения", LAST_NAME: "Овдина", TYPE_ID: null, SOURCE_ID: null, …}
1: {ID: "17", NAME: "Константин", LAST_NAME: "Петриченко", TYPE_ID: null, SOURCE_ID: "SELF", …}
2: {ID: "8", NAME: "Сергей", LAST_NAME: "", TYPE_ID: null, SOURCE_ID: "SELF", …}
Клиенты: [{…}]
Новое тестовое поле: (2) [{…}, {…}]
Общие контакты: (4) [{…}, {…}, {…}, {…}]
Поставщики: [{…}]
<ul>
<li>Без группы
<ul>
<li>Ксения</li>
<li>Алексей</li>
<li>Вадим</li>
</ul>
</li>
<li>Новое тестовое поле
<ul>
<li>Вова</li>
<li>...</li>
<li>...</li>
</ul>
</li>
<li>Клиенты</li>
</ul>
Answer the question
In order to leave comments, you need to log in
That's what I needed!
https://angular.io/api/common/KeyValuePipe
<ul *ngFor="let item of listContact | keyvalue">
{{item.key}}
<li *ngFor="let contact of item.value">{{ contact.NAME }}</li>
</ul>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question