Skip to content

Commit 2ab7fc0

Browse files
committed
Update ng-sample app.
1 parent 6de033f commit 2ab7fc0

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

ng-sample/app/app.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
}
1515

1616
button {
17-
font-size: 42;
17+
font-size: 20;
1818
horizontal-align: center;
1919
}

ng-sample/app/renderer-test.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
import {Inject, Component, View} from 'angular2/core';
1+
import {Component, Directive, Host, ElementRef, Input} from 'angular2/core';
22

33
@Component({
44
selector: 'templated-component',
5+
directives: [TemplatedComponent],
56
templateUrl: 'title.html'
67
})
78
export class TemplatedComponent {
9+
@Input() public renderChild: boolean = false;
10+
@Input() public text: string = "Hello, external templates";
11+
}
12+
13+
@Directive({
14+
selector: 'Progress',
15+
})
16+
export class ProgressComponent {
17+
constructor(private element: ElementRef) {
18+
}
19+
20+
ngOnInit() {
21+
this.element.nativeElement.value = 90;
22+
}
823
}
924

1025
@Component({
1126
selector: 'renderer-test',
12-
directives: [TemplatedComponent],
27+
directives: [TemplatedComponent, ProgressComponent],
1328
template: `
1429
<StackLayout orientation='vertical'>
15-
<templated-component *ngIf='showDetails'></templated-component>
30+
<Progress value="50" style="color: red"></Progress>
1631
<Label [class.valid]="isValid" [class.invalid]="!isValid" text='Name' fontSize='20' verticalAlignment='center' padding='20'></Label>
1732
<TextField #name text='John' fontSize='20' padding='20'></TextField>
1833
<Button [text]='buttonText' (tap)='onSave($event, name.text, $el)'></Button>
@@ -23,6 +38,7 @@ export class TemplatedComponent {
2338
<TextField *ngFor='#detailLine of detailLines' [text]='detailLine'></TextField>
2439
</StackLayout>
2540
<Label text='==============================' fontSize='20'></Label>
41+
<templated-component [renderChild]="true"></templated-component>
2642
</StackLayout>
2743
`,
2844
})
@@ -41,9 +57,8 @@ export class RendererTest {
4157
this.moreDetailsText = 'More details:';
4258

4359
this.detailLines = [
44-
"ngFor inside a ngIf",
45-
"Street address",
46-
"Country, city",
60+
"ngFor inside a ngIf 1",
61+
"ngFor inside a ngIf 2",
4762
];
4863
}
4964

ng-sample/app/title.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<Switch></Switch>
2-
<Label text="Hello, external templates"></Label>
1+
<Label [text]="text + ' -> ' + renderChild"></Label>
2+
<templated-component *ngIf="renderChild"></templated-component>

ng-sample/tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,9 @@
3535
"filesGlob": [
3636
"node_modules/tns-core-modules/tns-core-modules.d.ts",
3737
"app/**/*.ts"
38+
],
39+
"exclude": [
40+
"node_modules",
41+
"platforms"
3842
]
3943
}

0 commit comments

Comments
 (0)