Skip to content

Upgrade to beta.1 #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ctags-exclude
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ src/angular2
web/*.js
src/*.js
deps/angular/dist
deps/angular/tmp
2 changes: 1 addition & 1 deletion ng-sample/app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
}

button {
font-size: 42;
font-size: 20;
horizontal-align: center;
}
62 changes: 32 additions & 30 deletions ng-sample/app/renderer-test.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
import {Inject, Component, View} from 'angular2/core';
import {Component, Directive, Host, ElementRef, Input} from 'angular2/core';

@Component({
selector: 'templated-component',
directives: [TemplatedComponent],
templateUrl: 'title.html'
})
export class TemplatedComponent {
@Input() public renderChild: boolean = false;
@Input() public text: string = "Hello, external templates";
}

@Directive({
selector: 'Progress',
})
export class ProgressComponent {
constructor(private element: ElementRef) {
}

ngOnInit() {
this.element.nativeElement.value = 90;
}
}

@Component({
selector: 'renderer-test',
directives: [TemplatedComponent],
directives: [TemplatedComponent, ProgressComponent],
template: `
<TabView>
<TabView.items>
<TabViewItem title="First Tab">
<TabViewItem.view>
<StackLayout orientation='vertical'>
<templated-component></templated-component>
<Label [class.valid]="isValid" [class.invalid]="!isValid" text='Name' fontSize='20' verticalAlignment='center' padding='20'></Label>
<TextField #name text='John' fontSize='20' padding='20'></TextField>
<Button [text]='buttonText' (tap)='onSave($event, name.text, $el)'></Button>
<Button text='Toggle details' (tap)='onToggleDetails()'></Button>
<TextView *ngIf='showDetails' [text]='detailsText'></TextView>
<Label text='==============================' fontSize='20'></Label>
<StackLayout #more *ngIf='showDetails' orientation='vertical'>
<TextField *ngFor='#detailLine of detailLines' [text]='detailLine'></TextField>
</StackLayout>
<Label text='==============================' fontSize='20'></Label>
<StackLayout orientation='vertical'>
<Progress value="50" style="color: red"></Progress>
<Label [class.valid]="isValid" [class.invalid]="!isValid" text='Name' fontSize='20' verticalAlignment='center' padding='20'></Label>
<TextField #name text='John' fontSize='20' padding='20'></TextField>
<Button [text]='buttonText' (tap)='onSave($event, name.text, $el)'></Button>
<Button text='Toggle details' (tap)='onToggleDetails()'></Button>
<TextView *ngIf='showDetails' [text]='detailsText'></TextView>
<Label text='==============================' fontSize='20'></Label>
<StackLayout #more *ngIf='showDetails' orientation='vertical'>
<TextField *ngFor='#detailLine of detailLines' [text]='detailLine'></TextField>
</StackLayout>
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="Second Tab">
<TabViewItem.view>
<Label text="Completely different tab!"></Label>
</TabViewItem.view>
</TabViewItem>
</TabView.items>
</TabView>
<Label text='==============================' fontSize='20'></Label>
<templated-component [renderChild]="true"></templated-component>
</StackLayout>
`,
})
export class RendererTest {
Expand All @@ -54,9 +57,8 @@ export class RendererTest {
this.moreDetailsText = 'More details:';

this.detailLines = [
"ngFor inside a ngIf",
"Street address",
"Country, city",
"ngFor inside a ngIf 1",
"ngFor inside a ngIf 2",
];
}

Expand Down
3 changes: 2 additions & 1 deletion ng-sample/app/title.html
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<Label text="Hello, external templates"></Label>
<Label [text]="text + ' -> ' + renderChild"></Label>
<templated-component *ngIf="renderChild"></templated-component>
4 changes: 4 additions & 0 deletions ng-sample/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,9 @@
"filesGlob": [
"node_modules/tns-core-modules/tns-core-modules.d.ts",
"app/**/*.ts"
],
"exclude": [
"node_modules",
"platforms"
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"scripts": {},
"dependencies": {
"angular2": "2.0.0-beta.0",
"angular2": "2.0.0-beta.1",
"parse5": "1.4.2",
"punycode": "1.3.2",
"querystring": "0.2.0",
Expand Down
6 changes: 4 additions & 2 deletions src/nativescript-angular/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {platform, ComponentRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angul
import {bind, provide, Provider} from 'angular2/src/core/di';
import {DOM} from 'angular2/src/platform/dom/dom_adapter';

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

let nativeScriptProviders: ProviderArray = [
NativeScriptRootRenderer,
provide(RootRenderer, {useClass: NativeScriptRootRenderer}),
NativeScriptRenderer,
provide(Renderer, {useClass: NativeScriptRenderer}),
provide(XHR, {useClass: FileSystemXHR}),
Expand Down
Loading