i want to loop the user list with condition
<li *ngFor="let user of users" *ngIf="user.age>25"> {{user.name}} </li>
i know this is wrong. but,i want to use come like this. is there any possible way to this?
i want to loop the user list with condition
<li *ngFor="let user of users" *ngIf="user.age>25"> {{user.name}} </li>
i know this is wrong. but,i want to use come like this. is there any possible way to this?
You can use ng-container
as follows
<ng-container *ngFor="let user of users" >
<li *ngIf="user.age>25">
{{user.name}}
</li>
</ng-container>
You can't apply more than one structural directive to the same element. Just use ng-container:
<ng-container *ngFor="let user of users">
<li *ngIf="user.age>25"> {{user.name}} </li>
<ng-container>
ng-container is
a grouping element that doesn't interfere with styles or layout because Angular doesn't put it in the DOM.