-1
I would like to know how to limit my Ngfor to pass only 6 times??
In my . TS imported this module below...
import { NgForOf } from '@angular/common';
I tried to use it this way below but it didn’t work...
<div *ngFor="let concessionaria of concessionarias; index as i">
<vw-component-dealers [concessionaria]="concessionaria" ></vw-component-dealers>
</div>
It worked perfectly! Just take away one question? Below this Component, there is a button where when clicking it will show 3 more Component following the list passed by Ngfor, that is, if I displayed from 0 to 6, when clicking on the button, 3 more Components following from 7 to 10, and so on!! You could do this using this pipe?
– Guilherme Nunes
To do this, you can use ngIf with ngFor to show on the screen only the elements whose positions you want, the button can serve to change the range values.
– David Araujo
You can also add a property for your component that increments the values in the Slice from the button event: Slice:0+range:6+range.
– David Araujo
Here is an example using Slice with the component property: https://embed.plr.co/l1oTNT/
– David Araujo
The second way worked perfectly!! Thank you
– Guilherme Nunes