1

I want to do something like <span *ngIf="admins.includes(name) | async"> where admins is defined in the component class as admins:Observable<string[]> I know this does not work but is possible to achieve this in any way?

Thanks so much for help!

2
  • What is your actual goal? To imply show the span if name exists in the admin list - yeah? Commented Apr 20, 2018 at 1:45
  • Yes - that is correct. It admins was a simple list instead of observable I would do that <span *ngIf="admins.includes(name)> Commented Apr 20, 2018 at 1:54

1 Answer 1

3

The async pipe needs to be on the observable itself like below.

<span *ngIf="(admins | async)?.includes(name)">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.