1 | import {
|
2 | Directive,
|
3 | ElementRef,
|
4 | Input,
|
5 | ViewContainerRef,
|
6 | ComponentRef,
|
7 | Component,
|
8 | Renderer
|
9 | } from '@angular/core';
|
10 |
|
11 |
|
12 | @Component({
|
13 | selector: 'test',
|
14 | template: `<div>
|
15 | <p>test component</p>
|
16 | </div>`
|
17 | })
|
18 | export class TestComponent {
|
19 | private hostprop = 'clicked it';
|
20 |
|
21 | clicked() {
|
22 | console.log(this.hostprop);
|
23 | }
|
24 | }
|
25 |
|
26 | @Component({
|
27 | selector: 'app',
|
28 | template: `<div>
|
29 | <templation [component]="testComponent" [template]="template1" ></templation>
|
30 | <templation [component]="testComponent" [template]="template2" ></templation>
|
31 | </div>`
|
32 | })
|
33 | export class AppComponent {
|
34 | private testComponent = TestComponent;
|
35 | private template1 = `<p (click)="clicked()">the new template</p>`;
|
36 | private template2 = `<p (click)="clicked()">the newer template</p>`;
|
37 | }
|