diff --git a/package.json b/package.json index 1edd523..16c1ee6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "p3x-ng2-compile-html", - "version": "1.0.33-16", - "version-date": "1/16/2017, 8:28:21 PM", + "version": "1.0.35-18", + "version-date": "1/16/2017, 8:53:13 PM", "description": "Angular 2 Service to compile an HTML into a component Edit", "main": "src/index.ts", "scripts": { diff --git a/test/angular2/app/Page.ts b/test/angular2/app/Page.ts index 96542c8..b965a51 100644 --- a/test/angular2/app/Page.ts +++ b/test/angular2/app/Page.ts @@ -11,8 +11,9 @@ import {CompileHtmlService } from '../../../src'; @Component({ selector: 'p3x-ng2-compile-html-text', template: ` -
loading ...
-
loading ...
+
+
+
`, }) @Injectable() @@ -20,33 +21,42 @@ export class Page implements OnInit { @ViewChild('container', {read: ViewContainerRef}) container: ViewContainerRef; - data: string; + data1: string; + data2: string; ref: Page; - counter : number = 0; + counter1 : number = 0; + counter2 : number = 0; constructor( private compileHtmlService: CompileHtmlService ) { this.ref = this; - this.update(); } - private update() { - this.counter = this.counter + 1; - this.data = `
Done
If click works it says OK!${this.counter}`; + private update1() { + this.counter1++; + this.data1 = ` +
Service
Click me via a service! +
${this.counter1}
+`; + this.compileHtmlService.compile({ + template: this.data1, + container: this.container, + ref: this, + }) } - alert(string: string ) { - alert(string); - this.update(); + private update2() { + this.counter2++; + this.data2 = ` +
Attribute
Click me via a service! +
${this.counter2}
+`; } ngOnInit() { - this.compileHtmlService.compile({ - template: this.data, - container: this.container, - ref: this, - }) + this.update1(); + this.update2(); } } \ No newline at end of file