Skip to content

Commit 0cd3651

Browse files
committed
Merge pull request #35 from NativeScript/hdeshev/beta-1
Upgrade to beta.1
2 parents d9e4a51 + 2889259 commit 0cd3651

File tree

11 files changed

+468
-632
lines changed

11 files changed

+468
-632
lines changed

Diff for: .ctags-exclude

+1
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ src/angular2
2626
web/*.js
2727
src/*.js
2828
deps/angular/dist
29+
deps/angular/tmp

Diff for: ng-sample/app/app.css

+1-1
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
}

Diff for: ng-sample/app/renderer-test.ts

+32-30
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
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: `
14-
<TabView>
15-
<TabView.items>
16-
<TabViewItem title="First Tab">
17-
<TabViewItem.view>
18-
<StackLayout orientation='vertical'>
19-
<templated-component></templated-component>
20-
<Label [class.valid]="isValid" [class.invalid]="!isValid" text='Name' fontSize='20' verticalAlignment='center' padding='20'></Label>
21-
<TextField #name text='John' fontSize='20' padding='20'></TextField>
22-
<Button [text]='buttonText' (tap)='onSave($event, name.text, $el)'></Button>
23-
<Button text='Toggle details' (tap)='onToggleDetails()'></Button>
24-
<TextView *ngIf='showDetails' [text]='detailsText'></TextView>
25-
<Label text='==============================' fontSize='20'></Label>
26-
<StackLayout #more *ngIf='showDetails' orientation='vertical'>
27-
<TextField *ngFor='#detailLine of detailLines' [text]='detailLine'></TextField>
28-
</StackLayout>
29-
<Label text='==============================' fontSize='20'></Label>
29+
<StackLayout orientation='vertical'>
30+
<Progress value="50" style="color: red"></Progress>
31+
<Label [class.valid]="isValid" [class.invalid]="!isValid" text='Name' fontSize='20' verticalAlignment='center' padding='20'></Label>
32+
<TextField #name text='John' fontSize='20' padding='20'></TextField>
33+
<Button [text]='buttonText' (tap)='onSave($event, name.text, $el)'></Button>
34+
<Button text='Toggle details' (tap)='onToggleDetails()'></Button>
35+
<TextView *ngIf='showDetails' [text]='detailsText'></TextView>
36+
<Label text='==============================' fontSize='20'></Label>
37+
<StackLayout #more *ngIf='showDetails' orientation='vertical'>
38+
<TextField *ngFor='#detailLine of detailLines' [text]='detailLine'></TextField>
3039
</StackLayout>
31-
</TabViewItem.view>
32-
</TabViewItem>
33-
<TabViewItem title="Second Tab">
34-
<TabViewItem.view>
35-
<Label text="Completely different tab!"></Label>
36-
</TabViewItem.view>
37-
</TabViewItem>
38-
</TabView.items>
39-
</TabView>
40+
<Label text='==============================' fontSize='20'></Label>
41+
<templated-component [renderChild]="true"></templated-component>
42+
</StackLayout>
4043
`,
4144
})
4245
export class RendererTest {
@@ -54,9 +57,8 @@ export class RendererTest {
5457
this.moreDetailsText = 'More details:';
5558

5659
this.detailLines = [
57-
"ngFor inside a ngIf",
58-
"Street address",
59-
"Country, city",
60+
"ngFor inside a ngIf 1",
61+
"ngFor inside a ngIf 2",
6062
];
6163
}
6264

Diff for: ng-sample/app/title.html

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

Diff for: ng-sample/tsconfig.json

+4
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
}

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"scripts": {},
1616
"dependencies": {
17-
"angular2": "2.0.0-beta.0",
17+
"angular2": "2.0.0-beta.1",
1818
"parse5": "1.4.2",
1919
"punycode": "1.3.2",
2020
"querystring": "0.2.0",

Diff for: src/nativescript-angular/application.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import {platform, ComponentRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angul
1313
import {bind, provide, Provider} from 'angular2/src/core/di';
1414
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
1515

16-
import {Renderer} from 'angular2/src/core/render/api';
17-
import {NativeScriptRenderer} from './renderer';
16+
import {RootRenderer, Renderer} from 'angular2/src/core/render/api';
17+
import {NativeScriptRootRenderer, NativeScriptRenderer} from './renderer';
1818
import {NativeScriptDomAdapter} from './dom_adapter';
1919
import {XHR} from 'angular2/src/compiler/xhr';
2020
import {FileSystemXHR} from './xhr';
@@ -34,6 +34,8 @@ export function nativeScriptBootstrap(appComponentType: any,
3434
NativeScriptDomAdapter.makeCurrent();
3535

3636
let nativeScriptProviders: ProviderArray = [
37+
NativeScriptRootRenderer,
38+
provide(RootRenderer, {useClass: NativeScriptRootRenderer}),
3739
NativeScriptRenderer,
3840
provide(Renderer, {useClass: NativeScriptRenderer}),
3941
provide(XHR, {useClass: FileSystemXHR}),

0 commit comments

Comments
 (0)