ng2-bootstrap-base-modified
Version:
Native Angular Bootstrap Components Typeahead modified
31 lines (28 loc) • 909 B
text/typescript
import { Component, SecurityContext } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
({
selector: 'demo-alert-dynamic-html',
templateUrl: './dynamic-html.html'
})
export class DemoAlertDynamicHtmlComponent {
public alerts: any = [
{
type: 'success',
msg: `<strong>Well done!</strong> You successfully read this important alert message.`
},
{
type: 'info',
msg: `<strong>Heads up!</strong> This alert needs your attention, but it's not super important.`
},
{
type: 'danger',
msg: `<strong>Warning!</strong> Better check yourself, you're not looking too good.`
}
];
public constructor(sanitizer: DomSanitizer) {
this.alerts = this.alerts.map((alert:any) => ({
type: alert.type,
msg: sanitizer.sanitize(SecurityContext.HTML, alert.msg)
}));
}
}