1

I have a dropdown that is populated with an *ngFor that iterates over a list of users. I want to exclude the current user from the list. Creating a whole pipe seems overkill. Is there a simple way to do this since Angular2 won't let me have both an *ngFor and an *ngIf on the same element?

Reverend Bubbles
  • 1,363
  • 5
  • 15
  • 29

1 Answers1

1

Use *ngFor for the parent div and then for the child div use *ngIf to check whether it is a current user.

`<div *ngFor=“ let user of users”><div *ngIF= “user != currentUser”>user</div></div>`
  • This is very similar to what I finally found here: https://stackoverflow.com/questions/39570915/using-ngif-and-ngfor-in-option Thanks! – Reverend Bubbles Mar 20 '18 at 18:59