Display elements in ngfor loop depending attibute


#1

Hi,
i want to display elements in ngFor loop when they have a defined attribute, here is my code:

<button ion-item *ngFor=“let element of elements” (click)=“myfunc(element)” [color]="element.date !== undefined ? ‘danger’ : ‘’ ">
{{ element.name }}
<span *ngIf=“element.date !== undefined”>: ok at {{ element.date.toLocaleTimeString() }}

But i want not to display a line when one option is set: element.displayable = true ou false, so how not to show an element having displayable attribute to false?
I tried ng-container but ion-button is displayed as empty value.
Thank you for your help.


#2

In fact i managed to do it differently.
I save all list in another variable called ‘original’ and I copy it in variable I display.
I manipulate this one, and I filter it, when I want to show all items, I replace display with original variable.