I need to get all the values for substitution in ng For, I did, but outputs only the first elements
info.component.html
<div *ngFor="let infoItem of infoItems" class="info__item">
<div class="info__title">{{ infoItem.title }}</div>
<ul class="info__list">
<li class="info__list_item"><a href="#" class="info__link">{{ infoItem.sublinks[].title }}</a></li>
</ul>
</div>
info.items.ts
export const INFO_ITEMS: IInfoItem[] = [
{
title: 'Company',
sublinks: [
{
title: 'About CyberMetals',
},
{
title: 'Careers',
},
],
},
{
title: 'My Account',
sublinks: [
{
title: 'Registration',
},
{
title: 'Account Login',
},
],
},
>Solution :
You need another *ngFor for the sublinks[] as it’s also an array.
The HMTL should be like this:
<div *ngFor="let infoItem of infoItems" class="info__item">
<div class="info__title">{{ infoItem.title }}</div>
<ul class="info__list">
<div *ngFor="let sublinks of infoItem.sublinks" class="info__item">
<li class="info__list_item">
<a href="#" class="info__link">{{ sublinks.title }}</a>
</li>
</div>
</ul>
</div>