0

The following will display it as text (with<\i class.. backslash and without ) and not as HTML, probably very simple, but I can't find it :(

<div *ngFor="let facility of facilities;">
    {{facility['freewifi'] || facility['paidwifi'] ? '<\i class="fa fa-wifi fa-fw" aria-hidden="true"><\/i> :' : '' }}
</div>

Answer:

<i *ngIf="facility['freewifi'] || facility['paidwifi']" class="fa fa-wifi fa-fw" aria-hidden="true"></i>
4
  • Did you try to use innerHTML or outerHTML property? Commented Oct 28, 2016 at 4:48
  • 1
    use *ngIf: <i *ngIf="facility['freewifi'] || facility['paidwifi']" class="..."></i> Commented Oct 28, 2016 at 4:58
  • 1
    Might be stackoverflow.com/questions/37076867/… Commented Oct 28, 2016 at 5:00
  • @HarryNinh , that's it! Can you put this as the answer? Commented Oct 28, 2016 at 5:01

1 Answer 1

1

Use *ngIf instead:

<i *ngIf="facility['freewifi'] || facility['paidwifi']" class="fa fa-wifi fa-fw" aria-hidden="true"></i>
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.