How can I use in interpolations HTML tags in HTML templates with Angular 2?
For example:
<h1> {{title ? title : '<i>Title not set</i>'}} </h1>
If the title
is undefined then there should be a Title not set
in i
-Tags.
If I use the syntax above Angular will display exactly the expression (means with the {{, ?, :, }}) and does not evaluate it.
<h1 [innerHTML]="title ? title : '<i>Title not set</i>'"></h1>
See also In RC.1 some styles can't be added using binding syntax
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With