0
I have the Array below:
this.ca = this.categorias = [
{cate: 'oquefazer' , tipo: 'ACESSIBILIDADE:', nome: 'Cadeirante' , icone: 'fa-wheelchair'},
{cate: 'oquefazer' , tipo: 'ACESSIBILIDADE:', nome: 'Def.Visual' , icone: 'fa-blind'},
{cate: 'oquefazer' , tipo: 'ACESSIBILIDADE:', nome: 'Def.Auditivo' , icone: 'fa-deaf'},
{cate: 'oquefazer' , tipo: 'ACEITA CARTÕES:', nome: 'C.Cred. Amex' , icone: 'fa-cc-amex'},
{cate: 'oquefazer' , tipo: 'ACEITA CARTÕES:', nome: 'C.Cred. Visa' , icone: 'fa-cc-visa'},
{cate: 'oquefazer' , tipo: 'ACEITA CARTÕES:', nome: 'C.Cred. Diners' , icone: 'fa-cc-diners'},
{cate: 'oquefazer' , tipo: 'ACEITA CARTÕES:', nome: 'C.Cred. Mastercard', icone: 'fa-cc-mastercard'}
];
I would like to list this Array in a checkbox as follows:
ACESSIBILIDADE:
[] Cadeirante [] Def. Visual [] Def.Auditivo
ACEITA CARTÕES:
[] C.Cred.Amex []C.Cred Visa [] C.Cred. Diners []C.Cred.Mastercard
I am mounting the instruction below unsuccessfully.
Anyone can help?
<div>
<ul>
<li *ngFor="let item of ca">
<span *ngif {{item.tipo}} =
<label>{{item.tipo}}</label>
<input id={{item.nome}} type="checkbox" value={{item.nome}} />
<label>{{item.nome}}</label>
</li>
</ul>
</div>
Got it. That’s what I needed. Scroll through the different types of the array. In this case, I have a few more types, so I can do it by your example. Question: how to make a nfFor inside another, so first travel by type and then by name.
– Carlos Procidio
Yes, I only walked the array 2 times because of the way you want to demonstrate on the screen, depending on the view you can walk only one. Give yes tbm, you can have one *ngFor inside another yes, just have to be careful that complicates a little the control of the code, but, can use yes.
– LeAndrade