Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 return html instead of string [duplicate]

Tags:

html

angular

Let's assume I have a test property like that:

export class SomeComponent implements OnInit {

    testing = '<strong>Just testing</strong>';

}

And I add to my test.component.html this line:

{{ testing }}

The output will be <strong>Just testing</strong>. I want it to return Just Testing. How can I do that?

like image 718
Eliya Cohen Avatar asked Jun 15 '16 18:06

Eliya Cohen


1 Answers

You can use innerHTML for this:

<span [innerHTML]="testing"></span>
like image 197
Günter Zöchbauer Avatar answered Oct 22 '22 10:10

Günter Zöchbauer