- angular-compile.git
- test
- angular2
- app
- Page.ts
This file ( 967B ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
import {
Component,
Injectable,
ViewChild,
ViewContainerRef,
OnInit
} from '@angular/core';
import {CompileHtmlService } from '../../../src';
@Component({
selector: 'p3x-ng2-compile-html-text',
template: `
<div #container>loading ...</div>
<div [p3xCompileHtml]="data" [p3xCompileHtmlRef]="ref">loading ...</div>
`,
})
@Injectable()
export class Page implements OnInit {
@ViewChild('container', {read: ViewContainerRef}) container: ViewContainerRef;
data: string = `<div>Done</div><a href="javascript:void(0);" (click)="ref.alert('ok')">If click works it says OK!</a>`;
ref: Page;
constructor( private compileHtmlService: CompileHtmlService ) {
this.ref = this;
}
alert(string: string ) {
alert(string);
}
ngOnInit() {
this.compileHtmlService.compile({
template: this.data,
container: this.container,
ref: this,
})
}
}