Angular 2 Return Html Instead of String [Duplicate]

Angular 2 Return Html Instead of String [Duplicate]

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?

0

1 Answer

You can use innerHTML for this:

<span [innerHTML]="testing"></span>
James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.