Skip to content

Commit bd25640

Browse files
author
Tsvetan Raikov
committed
Updating to beta 16
1 parent a2a8d6e commit bd25640

23 files changed

+118
-88
lines changed

gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = function(grunt) {
1818
ts: {
1919
build: {
2020
src: [
21-
'src/**/*.ts',
21+
'src/**/*.ts',
2222
],
2323
outDir: outDir,
2424
options: {

ng-sample/app/App_Resources/iOS/Info.plist

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141
<string>UIInterfaceOrientationLandscapeLeft</string>
4242
<string>UIInterfaceOrientationLandscapeRight</string>
4343
</array>
44-
<key>NSAllowsArbitraryLoads</key>
45-
<true/>
44+
<key>NSAppTransportSecurity</key>
45+
<dict>
46+
<key>NSAllowsArbitraryLoads</key>
47+
<true/>
48+
</dict>
4649
</dict>
4750
</plist>

ng-sample/app/app.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,10 @@ nativeScriptBootstrap(RendererTest).then((compRef) => {
3535
//nativeScriptBootstrap(Benchmark);
3636
//nativeScriptBootstrap(ListTest);
3737
//nativeScriptBootstrap(ListTestAsync);
38-
//nativeScriptBootstrap(Benchmark);
39-
//nativeScriptBootstrap(ListTest);
40-
//nativeScriptBootstrap(ListTestAsync);
4138
//nativeScriptBootstrap(ImageTest);
4239
//nativeScriptBootstrap(NavigationTest, [NS_ROUTER_PROVIDERS]);
43-
// nativeScriptBootstrap(ActionBarTest, [NS_ROUTER_PROVIDERS], { startPageActionBarHidden: false });
44-
// nativeScriptBootstrap(ActionBarTest, [NS_ROUTER_PROVIDERS]);
45-
// nativeScriptBootstrap(ModalTest);
46-
// nativeScriptBootstrap(PlatfromDirectivesTest);
47-
// nativeScriptBootstrap(RouterOutletTest, [NS_ROUTER_PROVIDERS]);
40+
//nativeScriptBootstrap(ActionBarTest, [NS_ROUTER_PROVIDERS], { startPageActionBarHidden: false });
41+
//nativeScriptBootstrap(ActionBarTest, [NS_ROUTER_PROVIDERS]);
42+
//nativeScriptBootstrap(ModalTest);
43+
//nativeScriptBootstrap(PlatfromDirectivesTest);
44+
//nativeScriptBootstrap(RouterOutletTest, [NS_ROUTER_PROVIDERS]);

ng-sample/app/examples/action-bar/action-bar-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class SecondComponent {
8080
directives: [NS_ROUTER_DIRECTIVES],
8181
template: `
8282
<GridLayout>
83-
<page-router-outlet></page-router-outlet>
83+
<page-router-outlet></page-router-outlet>
8484
</GridLayout>
8585
`
8686
})

ng-sample/app/examples/navigation/nav-component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Component} from 'angular2/core';
22
import {ROUTER_DIRECTIVES, Router, OnActivate, OnDeactivate, CanReuse, OnReuse,
3-
LocationStrategy, RouteParams, ComponentInstruction, RouteConfig, Location } from 'angular2/router';
3+
RouteParams, ComponentInstruction, RouteConfig } from 'angular2/router';
4+
import {Location, LocationStrategy} from 'angular2/platform/common';
45
import {topmost} from "ui/frame";
56
import {Page} from "ui/page";
67
import {NS_ROUTER_DIRECTIVES} from "../../nativescript-angular/router/ns-router";

ng-sample/app/examples/renderer-test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ export class RendererTest {
5454
'search': null,
5555
'selectedIndex': 0,
5656
'listPickerItems': [
57-
1,2,3,4,5
57+
1,2,3,4
5858
],
5959
'segmentedBarItems': [
6060
{'title': 'first'},
6161
{'title': 'second'},
62-
{'title': 'third'}
62+
{'title': 'third'},
63+
{'title': 'fourth'}
6364
]
6465
});
6566

ng-sample/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,38 @@
2525
"dependencies": {
2626
"tns-core-modules": "^2.0.0-angular-4",
2727
"nativescript-intl": "^0.0.2",
28-
"angular2": "2.0.0-beta.14",
28+
"angular2": "2.0.0-beta.16",
2929
"es6-shim": "^0.35.0",
3030
"parse5": "1.4.2",
3131
"punycode": "1.3.2",
3232
"querystring": "0.2.0",
3333
"url": "0.10.3",
3434
"reflect-metadata": "0.1.2",
3535
"rxjs": "5.0.0-beta.2",
36-
"zone.js": "^0.6.6"
36+
"zone.js": "^0.6.12"
3737
},
3838
"devDependencies": {
39+
"babel-traverse": "6.7.6",
40+
"babel-types": "6.7.7",
41+
"babylon": "6.7.0",
42+
"filewalker": "0.1.2",
3943
"grunt": "0.4.5",
4044
"grunt-contrib-clean": "0.6.0",
4145
"grunt-contrib-copy": "0.8.0",
4246
"grunt-shell": "1.1.2",
4347
"grunt-ts": "5.0.0-beta.5",
48+
"lazy": "1.0.11",
4449
"nativescript-dev-typescript": "^0.3.1",
4550
"nativescript-dev-webpack": "0.0.7",
4651
"typescript": "1.8.2"
4752
},
4853
"nativescript": {
4954
"id": "org.nativescript.ngsample",
5055
"tns-android": {
51-
"version": "1.7.1"
56+
"version": "2.0.0"
5257
},
5358
"tns-ios": {
54-
"version": "1.7.0"
59+
"version": "2.0.0"
5560
}
5661
}
5762
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
"dependencies": {
1717
"tns-core-modules": "^2.0.0",
1818
"nativescript-intl": "^0.0.2",
19-
"angular2": "2.0.0-beta.14",
19+
"angular2": "2.0.0-beta.16",
2020
"es6-shim": "^0.35.0",
2121
"parse5": "1.4.2",
2222
"punycode": "1.3.2",
2323
"querystring": "0.2.0",
2424
"url": "0.10.3",
2525
"reflect-metadata": "0.1.2",
2626
"rxjs": "5.0.0-beta.2",
27-
"zone.js": "^0.6.6"
27+
"zone.js": "^0.6.12"
2828
},
2929
"devDependencies": {
3030
"grunt": "0.4.5",

src/nativescript-angular/application.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import "zone.js/dist/zone-node"
44
import 'reflect-metadata';
55
import './polyfills/array';
66
import {isPresent, Type} from 'angular2/src/facade/lang';
7-
import {platform, ComponentRef, PlatformRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angular2/core';
7+
import {ReflectiveInjector, reflector, coreLoadAndBootstrap, createPlatform,
8+
getPlatform, assertPlatform, ComponentRef, PlatformRef, PLATFORM_DIRECTIVES, PLATFORM_PIPES} from 'angular2/core';
89
import {bind, provide, Provider} from 'angular2/src/core/di';
910
import {DOM} from 'angular2/src/platform/dom/dom_adapter';
1011

@@ -20,8 +21,8 @@ import {COMPILER_PROVIDERS} from 'angular2/src/compiler/compiler';
2021
import {PLATFORM_COMMON_PROVIDERS} from 'angular2/src/core/platform_common_providers';
2122
import {COMMON_DIRECTIVES, COMMON_PIPES, FORM_PROVIDERS} from "angular2/common";
2223
import {NS_DIRECTIVES} from './directives';
23-
24-
import {bootstrap as angularBootstrap} from 'angular2/bootstrap';
24+
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
25+
import {bootstrap as angularBootstrap} from 'angular2/platform/browser';
2526

2627
import {Page} from 'ui/page';
2728
import {TextView} from 'ui/text-view';
@@ -34,8 +35,6 @@ import {defaultPageProvider, defaultDeviceProvider} from "./platform-providers";
3435
import * as nativescriptIntl from "nativescript-intl";
3536
global.Intl = nativescriptIntl;
3637

37-
let _platform: PlatformRef = null;
38-
3938
export interface AppOptions {
4039
cssFile?: string;
4140
startPageActionBarHidden?: boolean;
@@ -72,10 +71,14 @@ export function bootstrap(appComponentType: any,
7271
appProviders.push(customProviders);
7372
}
7473

75-
if (!_platform) {
76-
_platform = platform(platformProviders);
74+
var platform = getPlatform();
75+
if (!isPresent(platform)) {
76+
platform = createPlatform(ReflectiveInjector.resolveAndCreate(platformProviders));
7777
}
78-
return _platform.application(appProviders).bootstrap(appComponentType);
78+
79+
reflector.reflectionCapabilities = new ReflectionCapabilities();
80+
var appInjector = ReflectiveInjector.resolveAndCreate(appProviders, platform.injector);
81+
return coreLoadAndBootstrap(appInjector, appComponentType);
7982
}
8083

8184
export function nativeScriptBootstrap(appComponentType: any, customProviders?: ProviderArray, appOptions?: AppOptions): Promise<ComponentRef> {
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import {DynamicComponentLoader, ComponentRef, ElementRef, Component, Type} from 'angular2/core';
1+
import {DynamicComponentLoader, ComponentRef, ViewContainerRef, Component, Type, ViewChild} from 'angular2/core';
22

33
/**
4-
* Wrapper component used for loading compnenets when navigating
5-
* It uses DetachedContainer as selector so that it is elementRef is not attached to the visual tree.
4+
* Wrapper component used for loading components when navigating
5+
* It uses DetachedContainer as selector so that it is containerRef is not attached to the visual tree.
66
*/
77
@Component({
88
selector: 'DetachedContainer',
99
template: `<Placeholder #loader></Placeholder>`
1010
})
1111
export class DetachedLoader {
12+
13+
@ViewChild('loader', { read: ViewContainerRef }) containerRef: ViewContainerRef;
14+
1215
constructor(
13-
private element: ElementRef,
1416
private loader: DynamicComponentLoader
1517
) {
1618
}
1719

1820
public loadComponent(componentType: Type): Promise<ComponentRef> {
19-
return this.loader.loadIntoLocation(componentType, this.element, 'loader');
21+
return this.loader.loadNextToLocation(componentType, this.containerRef);
2022
}
2123
}

src/nativescript-angular/directives/dialogs.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {DynamicComponentLoader, ElementRef, Injector, provide, Type, Injectable, ComponentRef, Directive} from 'angular2/core';
1+
import {ReflectiveInjector, DynamicComponentLoader, ViewContainerRef, Injector, provide, Type, Injectable, ComponentRef, Directive} from 'angular2/core';
22
import {Page} from 'ui/page';
33
import {View} from 'ui/core/view';
44
import {DetachedLoader} from '../common/detached-loader';
@@ -17,20 +17,20 @@ export class ModalDialogParams {
1717

1818
@Injectable()
1919
export class ModalDialogService {
20-
private elementRef: ElementRef;
20+
private containerRef: ViewContainerRef;
2121

2222
constructor(
2323
private page: Page,
2424
private loader: DynamicComponentLoader) {
2525
}
2626

27-
public registerElementRef(ref: ElementRef) {
28-
this.elementRef = ref;
27+
public registerViewContainerRef(ref: ViewContainerRef) {
28+
this.containerRef = ref;
2929
}
3030

3131
public showModal(type: Type, options: ModalDialogOptions): Promise<any> {
32-
if (!this.elementRef) {
33-
throw new Error("No elementRef: Make sure you have the modal-dialog-host directive inside your component.");
32+
if (!this.containerRef) {
33+
throw new Error("No viewContainerRef: Make sure you have the modal-dialog-host directive inside your component.");
3434
}
3535
return new Promise((resove, reject) => {
3636
const page = new Page();
@@ -39,16 +39,16 @@ export class ModalDialogService {
3939
const closeCallback = (...args) => {
4040
resove.apply(undefined, args);
4141
page.closeModal();
42-
detachedLoaderRef.dispose();
42+
detachedLoaderRef.destroy();
4343
}
4444
const modalParams = new ModalDialogParams(options.context, closeCallback);
4545

46-
const providers = Injector.resolve([
46+
const providers = ReflectiveInjector.resolve([
4747
provide(Page, { useValue: page }),
4848
provide(ModalDialogParams, { useValue: modalParams }),
4949
]);
5050

51-
this.loader.loadNextToLocation(DetachedLoader, this.elementRef, providers)
51+
this.loader.loadNextToLocation(DetachedLoader, this.containerRef, providers)
5252
.then((loaderRef) => {
5353
detachedLoaderRef = loaderRef;
5454
return (<DetachedLoader>loaderRef.instance).loadComponent(type)
@@ -71,7 +71,7 @@ export class ModalDialogService {
7171
selector: "[modal-dialog-host]"
7272
})
7373
export class ModalDialogHost {
74-
constructor(elementRef: ElementRef, modalService: ModalDialogService) {
75-
modalService.registerElementRef(elementRef);
74+
constructor(containerRef: ViewContainerRef, modalService: ModalDialogService) {
75+
modalService.registerViewContainerRef(containerRef);
7676
}
7777
}

src/nativescript-angular/directives/list-view-comp.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
ElementRef,
55
TemplateRef,
66
ContentChild,
7-
AppViewManager,
87
EmbeddedViewRef,
98
ViewContainerRef,
109
HostListener,
@@ -42,7 +41,7 @@ export class ListViewComponent {
4241
private _items: any;
4342
private _differ: IterableDiffer;
4443

45-
@ViewChild('loader') public loader: ElementRef;
44+
@ViewChild('loader', { read: ViewContainerRef }) loader: ViewContainerRef;
4645

4746
@Output() public setupItemView: EventEmitter<SetupItemViewArgs> = new EventEmitter<SetupItemViewArgs>();
4847

@@ -62,11 +61,10 @@ export class ListViewComponent {
6261

6362
private timerId: number;
6463
private doCheckDelay = 5;
65-
64+
6665
constructor(private _elementRef: ElementRef,
6766
private _iterableDiffers: IterableDiffers,
68-
private _cdr: ChangeDetectorRef,
69-
private _appViewManager: AppViewManager) {
67+
private _cdr: ChangeDetectorRef) {
7068
this.listView = _elementRef.nativeElement;
7169
}
7270

@@ -87,7 +85,7 @@ export class ListViewComponent {
8785
}
8886
else {
8987
console.log("ListView.onItemLoading: " + index + " - Creating view from template");
90-
viewRef = this._appViewManager.createEmbeddedViewInContainer(this.loader, 0, this.itemTemplate);
88+
viewRef = this.loader.createEmbeddedView(this.itemTemplate, 0);
9189
args.view = getSingleViewFromViewRef(viewRef);
9290
args.view[NG_VIEW] = viewRef;
9391
}

src/nativescript-angular/router/ns-location-strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import application = require("application");
2-
import { LocationStrategy } from 'angular2/router';
2+
import { LocationStrategy } from 'angular2/platform/common';
33
import { NgZone, ApplicationRef, Inject, forwardRef } from 'angular2/core';
44
import { log } from "./common";
55
import { topmost } from "ui/frame";

src/nativescript-angular/router/ns-router-link.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Directive, Input} from 'angular2/core';
22
import {isString} from 'angular2/src/facade/lang';
3-
import {Router, Location, Instruction} from 'angular2/router';
3+
import {Router, Instruction} from 'angular2/router';
4+
import {Location} from 'angular2/platform/common';
45
import { log } from "./common";
56

67
/**

src/nativescript-angular/router/ns-router.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {Type} from 'angular2/src/facade/lang';
22
import {NSRouterLink} from './ns-router-link';
33
import {PageRouterOutlet} from './page-router-outlet';
44
import {NSLocationStrategy} from './ns-location-strategy';
5-
import {ROUTER_PROVIDERS, LocationStrategy} from 'angular2/router';
5+
import {ROUTER_PROVIDERS} from 'angular2/router';
6+
import {LocationStrategy} from 'angular2/platform/common';
67
import {provide} from 'angular2/core';
78
import { CATEGORY } from "./common";
89

0 commit comments

Comments
 (0)