18

In angular 1 binding works like ng-bind-html="htmlValue"

How to bind html in Angular 2.0

navin saini
  • 181
  • 1
  • 1
  • 4

1 Answers1

47

I think that you could use the innerHtml attribute and bind something on it:

<span [innerHtml]="someHtmlContent"></span>

Here is a sample:

@Component({
  selector: 'first-app',
  template: `
    <span [innerHtml]="value"></span>
  `
})
export class AppComponent {
  constructor(private http:Http) {
    this.value = '<strong>test</strong>';
  }
}
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Thierry Templier
  • 198,364
  • 44
  • 396
  • 360