UNPKG

2.61 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var __metadata = (this && this.__metadata) || function (k, v) {
9 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10};
11var core_1 = require('@angular/core');
12var TestComponent = (function () {
13 function TestComponent(vcRef) {
14 this.vcRef = vcRef;
15 this.hostprop = 'clicked it';
16 this.someValue = 1;
17 console.log('pc');
18 console.log(this.vcRef);
19 }
20 TestComponent.prototype.clicked = function () {
21 console.log(this.hostprop);
22 console.log(this.vcRef);
23 };
24 TestComponent.prototype.ngOnInit = function () {
25 var outerScope = this;
26 setInterval(function () {
27 outerScope.someValue++;
28 }, 3000);
29 };
30 TestComponent = __decorate([
31 core_1.Component({
32 selector: 'test',
33 template: "<div>\n <p>test component</p>\n </div>"
34 }),
35 __metadata('design:paramtypes', [core_1.ViewContainerRef])
36 ], TestComponent);
37 return TestComponent;
38}());
39exports.TestComponent = TestComponent;
40var AppComponent = (function () {
41 function AppComponent(injector) {
42 this.injector = injector;
43 this.testComponent = TestComponent;
44 this.componentDeps = [core_1.ViewContainerRef];
45 this.template1 = "<p (click)=\"clicked()\">the new template1{{someValue}}</p>";
46 this.template2 = "<p (click)=\"clicked()\">the newer template</p>";
47 }
48 AppComponent = __decorate([
49 core_1.Component({
50 selector: 'app',
51 template: "<div>\n <templation [component]=\"testComponent\" [componentDeps]=\"componentDeps\" [template]=\"template1\" ></templation>\n <templation [component]=\"testComponent\" [componentDeps]=\"componentDeps\" [template]=\"template2\" ></templation>\n </div>"
52 }),
53 __metadata('design:paramtypes', [core_1.Injector])
54 ], AppComponent);
55 return AppComponent;
56}());
57exports.AppComponent = AppComponent;
58//# sourceMappingURL=app.component.js.map
\No newline at end of file