I'm showing products:
<li *ngFor="let product of products">{{product.id}}</li>
I want to limit the number of entries shown using the property on component. Is there a built-in pipe to do that or I should create my own pipe?
Here is how I see it:
<li *ngFor="let product of products | length[propertyOnComponent]">{{product.id}}</li>
So, if propertyOnComponent is 3, then only 3 entries will be shown.
See slice in https://angular.io/docs/ts/latest/guide/pipes.html
<li *ngFor="let product of products | slice:0:propertyOnComponent">{{product.id}}</li>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With