I need to view different array indexes and their values inside my template. I have this object:
vegetables = [
{name: 'Carrot', type: 'vegetable'},
{name: 'Onion', type: 'vegetable'},
{name: 'Potato', type: 'vegetable'},
{name: 'Capsicum', type: 'vegetable'}],
[
{name: 'Carrotas', type: 'vegetable'},
{name: 'Onionas', type: 'vegetable'},
{name: 'Potatoas', type: 'vegetable'},
{name: 'Capsicumas', type: 'vegetable'}]
And I do this:
<li class="list-group-item list-group-item-action list-group-item-success" [draggable] *ngFor="let items of [vegetables[0]]"
[dragClass]="'active'" [dragTransitClass]="'active'" [dragData]="item" [dragScope]="item.type" [dragEnabled]="dragEnabled">
{{item.name}}
</li>
But [vegetables[0]]
only outputs "Carrot" from the list and that's it. Instead I need it to output first array and all its content, then on the second iteration, output second array with "Carrotas", "Onionas" etc. How do achieve this?
0
will be replaced with i
which will be incremented every time to go through different arrays of lists inside vegetables
.