In angular 1 binding works like ng-bind-html="htmlValue"
How to bind html in Angular 2.0
In angular 1 binding works like ng-bind-html="htmlValue"
How to bind html in Angular 2.0
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>';
}
}
[innerHtml]
, like this, which is not working <span [innerHtml]="<a [routerLink]="/test"></a>"></span>
This router link is not getting compiled. –
Guerrero *ngIf
on the a
instead of an [innerHtml]
. –
Haustellum © 2022 - 2024 — McMap. All rights reserved.
<em onmouseover="this.textContent='PWN3D!'">click here</em>
and the JavaScript code is actually executed on the click... – Doorframe