Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a5ecaa2

Browse files
author
Alexander Vakrilov
authored
Merge pull request #540 from NativeScript/angular-2.2.0
Update to 2.2.1
2 parents 3aac330 + 08ef9d7 commit a5ecaa2

File tree

10 files changed

+98
-91
lines changed

10 files changed

+98
-91
lines changed

‎nativescript-angular/animation-driver.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { AnimationPlayer, AnimationStyles, AnimationKeyframe } from "./private_import_core";
1+
import { AnimationPlayer } from "@angular/core";
2+
import { AnimationStyles, AnimationKeyframe } from "./private_import_core";
23
import { NativeScriptAnimationPlayer } from './animation-player';
34
import { View } from "ui/core/view";
45
import { getPropertyByCssName } from 'ui/styling/style-property';

‎nativescript-angular/animation-player.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { AnimationPlayer, AnimationKeyframe } from "./private_import_core";
1+
import { AnimationPlayer } from "@angular/core";
2+
import { AnimationKeyframe } from "./private_import_core";
23
import { KeyframeAnimation, KeyframeAnimationInfo, KeyframeInfo, KeyframeDeclaration } from 'ui/animation/keyframe-animation';
34
import { View } from "ui/core/view";
45
import { AnimationCurve } from "ui/enums";

‎nativescript-angular/dom-adapter.ts‎

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,60 +16,69 @@ export enum SecurityContext {
1616

1717
export class NativeScriptElementSchemaRegistry extends ElementSchemaRegistry {
1818
hasProperty(tagName: string, propName: string): boolean {
19-
return true;
19+
return true;
2020
}
2121

2222
hasElement(tagName: string, schemaMetas: SchemaMetadata[]): boolean {
23-
return true;
23+
return true;
2424
}
2525

2626

2727
getMappedPropName(propName: string): string {
28-
return propName;
28+
return propName;
2929
}
3030

3131
getDefaultComponentElementName(): string {
32-
return 'ng-component';
32+
return 'ng-component';
3333
}
3434

3535
securityContext(tagName: string, propName: string): any {
36-
return SecurityContext.NONE;
36+
return SecurityContext.NONE;
3737
}
3838

39-
validateProperty(name: string): {error: boolean, msg?: string} {
40-
return {error: false};
39+
validateProperty(name: string): {error: boolean, msg?: string} {
40+
return {error: false};
4141
}
4242

43-
validateAttribute(name: string): {error: boolean, msg?: string} {
44-
return {error: false};
43+
validateAttribute(name: string): {error: boolean, msg?: string} {
44+
return {error: false};
4545
}
4646

4747
allKnownElementNames(): string[] {
48-
return [];
48+
return [];
49+
}
50+
51+
normalizeAnimationStyleProperty(propName: string): string {
52+
return propName;
53+
}
54+
55+
normalizeAnimationStyleValue(camelCaseProp: string, userProvidedProp: string, val: string | number):
56+
{ error: string, value: string } {
57+
return { error: null, value: val.toString() };
4958
}
5059
}
5160

5261
export class NativeScriptDomAdapter extends Parse5DomAdapter {
5362
static makeCurrent() {
54-
rendererLog("Setting DOM");
55-
setRootDomAdapter(new NativeScriptDomAdapter());
63+
rendererLog("Setting DOM");
64+
setRootDomAdapter(new NativeScriptDomAdapter());
5665
}
5766

5867
hasProperty(element, name: string) {
59-
//TODO: actually check if the property exists.
60-
return true;
68+
//TODO: actually check if the property exists.
69+
return true;
6170
}
6271

6372
log(arg: any): void {
64-
print(arg);
73+
print(arg);
6574
}
6675

6776
logError(arg: any): void {
68-
print(arg);
77+
print(arg);
6978
}
7079

7180
logGroup(arg: any): void {
72-
print(arg);
81+
print(arg);
7382
}
7483

7584
logGroupEnd(): void {

‎nativescript-angular/package.json‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
},
2222
"dependencies": {
2323
"nativescript-intl": "~0.0.4",
24-
"@angular/core": "~2.1.1",
25-
"@angular/common": "~2.1.1",
26-
"@angular/compiler": "~2.1.1",
27-
"@angular/http": "~2.1.1",
28-
"@angular/platform-browser": "~2.1.1",
29-
"@angular/platform-browser-dynamic": "~2.1.1",
30-
"@angular/forms": "~2.1.1",
31-
"@angular/router": "~3.1.1",
24+
"@angular/core": "~2.2.1",
25+
"@angular/common": "~2.2.1",
26+
"@angular/compiler": "~2.2.1",
27+
"@angular/http": "~2.2.1",
28+
"@angular/platform-browser": "~2.2.1",
29+
"@angular/platform-browser-dynamic": "~2.2.1",
30+
"@angular/forms": "~2.2.1",
31+
"@angular/router": "~3.2.1",
3232
"rxjs": "5.0.0-beta.12",
3333
"reflect-metadata": "~0.1.8",
3434
"parse5": "1.3.2",
@@ -37,10 +37,10 @@
3737
"url": "0.10.3"
3838
},
3939
"devDependencies": {
40-
"tns-core-modules": ">=2.2.0 || >=2.2.0-2016",
40+
"tns-core-modules": ">=2.4.0 || >=2.4.0-2016",
4141
"zone.js": "^0.6.21",
4242
"typescript": "^2.0.2",
43-
"@angular/compiler-cli": "~2.1.1"
43+
"@angular/compiler-cli": "~2.2.1"
4444
},
4545
"nativescript": {}
4646
}

‎nativescript-angular/renderer.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {
22
Inject, Injectable, Optional, NgZone,
33
Renderer, RootRenderer, RenderComponentType,
44
} from '@angular/core';
5-
import { AnimationPlayer, AnimationStyles, AnimationKeyframe } from "./private_import_core";
5+
import { AnimationPlayer } from "@angular/core";
6+
import { AnimationStyles, AnimationKeyframe } from "./private_import_core";
67
import {APP_ROOT_VIEW, DEVICE} from "./platform-providers";
78
import {isBlank} from "./lang-facade";
89
import {View} from "ui/core/view";

‎nativescript-angular/router/page-router-outlet.ts‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,17 @@ class RefCache {
6060
export class PageRouterOutlet {
6161
private viewUtil: ViewUtil;
6262
private refCache: RefCache = new RefCache();
63-
private isInitalPage: boolean = true;
63+
private isInitialPage: boolean = true;
6464
private detachedLoaderFactory: ComponentFactory<DetachedLoader>;
6565

6666
private currentActivatedComp: ComponentRef<any>;
6767
private currentActivatedRoute: ActivatedRoute;
6868

6969
public outletMap: RouterOutletMap;
7070

71+
get locationInjector(): Injector { return this.containerRef.injector; }
72+
get locationFactoryResolver(): ComponentFactoryResolver { return this.resolver; }
73+
7174
get isActivated(): boolean {
7275
return !!this.currentActivatedComp;
7376
}
@@ -93,7 +96,7 @@ export class PageRouterOutlet {
9396
@Attribute('name') name: string,
9497
private locationStrategy: NSLocationStrategy,
9598
private componentFactoryResolver: ComponentFactoryResolver,
96-
resolver: ComponentFactoryResolver,
99+
privateresolver: ComponentFactoryResolver,
97100
private frame: Frame,
98101
@Inject(DEVICE) device: Device,
99102
@Inject(PAGE_FACTORY) private pageFactory: PageFactory) {
@@ -143,33 +146,33 @@ export class PageRouterOutlet {
143146
* This method in turn is responsible for calling the `routerOnActivate` hook of its child.
144147
*/
145148
activate(
146-
activatedRoute: ActivatedRoute, loadedResolver: ComponentFactoryResolver,
147-
loadedInjector: Injector, providers: ResolvedReflectiveProvider[],
148-
outletMap: RouterOutletMap): void {
149+
activatedRoute: ActivatedRoute, resolver: ComponentFactoryResolver, injector: Injector,
150+
providers: ResolvedReflectiveProvider[], outletMap: RouterOutletMap): void {
149151
this.outletMap = outletMap;
150152
this.currentActivatedRoute = activatedRoute;
151153

152154
if (this.locationStrategy._isPageNavigatingBack()) {
153155
this.activateOnGoBack(activatedRoute, providers, outletMap);
154156
} else {
155-
this.activateOnGoForward(activatedRoute, providers, outletMap, loadedResolver);
157+
this.activateOnGoForward(activatedRoute, providers, outletMap, resolver,injector);
156158
}
157159
}
158160

159161
private activateOnGoForward(
160162
activatedRoute: ActivatedRoute,
161163
providers: ResolvedReflectiveProvider[],
162164
outletMap: RouterOutletMap,
163-
loadedResolver: ComponentFactoryResolver): void {
165+
loadedResolver: ComponentFactoryResolver,
166+
injector: Injector): void {
164167
const factory = this.getComponentFactory(activatedRoute, loadedResolver);
165168

166169
const pageRoute = new PageRoute(activatedRoute);
167170
providers = [...providers, ...ReflectiveInjector.resolve([{ provide: PageRoute, useValue: pageRoute }])];
168171

169-
if (this.isInitalPage) {
170-
log("PageRouterOutlet.activate() inital page - just load component");
171-
this.isInitalPage = false;
172-
const inj = ReflectiveInjector.fromResolvedProviders(providers, this.containerRef.parentInjector);
172+
if (this.isInitialPage) {
173+
log("PageRouterOutlet.activate() initial page - just load component");
174+
this.isInitialPage = false;
175+
const inj = ReflectiveInjector.fromResolvedProviders(providers, injector);
173176
this.currentActivatedComp = this.containerRef.createComponent(factory, this.containerRef.length, inj, []);
174177
this.refCache.push(this.currentActivatedComp, pageRoute, outletMap, null);
175178

@@ -180,7 +183,7 @@ export class PageRouterOutlet {
180183
const pageResolvedProvider = ReflectiveInjector.resolve([
181184
{ provide: Page, useValue: page }
182185
]);
183-
const childInjector = ReflectiveInjector.fromResolvedProviders([...providers, ...pageResolvedProvider], this.containerRef.parentInjector);
186+
const childInjector = ReflectiveInjector.fromResolvedProviders([...providers, ...pageResolvedProvider], injector);
184187
const loaderRef = this.containerRef.createComponent(this.detachedLoaderFactory, this.containerRef.length, childInjector, []);
185188

186189
this.currentActivatedComp = loaderRef.instance.loadWithFactory(factory);
@@ -193,7 +196,7 @@ export class PageRouterOutlet {
193196
activatedRoute: ActivatedRoute,
194197
providers: ResolvedReflectiveProvider[],
195198
outletMap: RouterOutletMap): void {
196-
log("PageRouterOutlet.activate() - Back naviation, so load from cache");
199+
log("PageRouterOutlet.activate() - Back navigation, so load from cache");
197200

198201
this.locationStrategy._finishBackPageNavigation();
199202

‎ng-sample/app/app.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
//profiling.start('application-start');
77

88
// "nativescript-angular/application" import should be first in order to load some required settings (like globals and reflect-metadata)
9-
import { NativeScriptModule, platformNativeScriptDynamic, onAfterLivesync, onBeforeLivesync } from "nativescript-angular/platform";
9+
import { NativeScriptModule, platformNativeScriptDynamic } from "nativescript-angular/platform";
10+
import { onAfterLivesync, onBeforeLivesync } from "nativescript-angular/platform-common";
1011
import { NgModule } from "@angular/core";
1112
import { Router } from "@angular/router";
1213
import { NativeScriptRouterModule } from "nativescript-angular/router";

‎ng-sample/package.json‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
},
2424
"homepage": "https://github.com/NativeScript/template-hello-world",
2525
"dependencies": {
26-
"tns-core-modules": "2.3.0",
26+
"tns-core-modules": "2.4.0",
2727
"nativescript-angular": "file:../nativescript-angular",
2828
"nativescript-intl": "^0.0.4",
29-
"@angular/core": "~2.1.1",
30-
"@angular/common": "~2.1.1",
31-
"@angular/compiler": "~2.1.1",
32-
"@angular/forms": "~2.1.1",
33-
"@angular/http": "~2.1.1",
34-
"@angular/platform-browser": "~2.1.1",
35-
"@angular/platform-browser-dynamic": "~2.1.1",
36-
"@angular/router": "~3.1.0",
29+
"@angular/core": "~2.2.1",
30+
"@angular/common": "~2.2.1",
31+
"@angular/compiler": "~2.2.1",
32+
"@angular/forms": "~2.2.1",
33+
"@angular/http": "~2.2.1",
34+
"@angular/platform-browser": "~2.2.1",
35+
"@angular/platform-browser-dynamic": "~2.2.1",
36+
"@angular/router": "~3.2.1",
3737
"rxjs": "5.0.0-beta.12"
3838
},
3939
"devDependencies": {
@@ -51,10 +51,10 @@
5151
"nativescript": {
5252
"id": "org.nativescript.ngsample",
5353
"tns-android": {
54-
"version": "2.3.0"
54+
"version": "2.4.0"
5555
},
5656
"tns-ios": {
57-
"version": "2.3.0"
57+
"version": "2.4.0"
5858
}
5959
}
6060
}

‎tests/app/tests/platform-filter-components.ts‎

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
//make sure you import mocha-config before @angular/core
2-
import {assert} from "./test-config";
3-
import {Component, ElementRef} from "@angular/core";
4-
import {ProxyViewContainer} from "ui/proxy-view-container";
5-
import {dumpView, createDevice} from "./test-utils";
6-
import {TestApp} from "./test-app";
7-
import {DEVICE} from "nativescript-angular/platform-providers";
8-
import {platformNames} from "platform";
2+
import { assert } from "./test-config";
3+
import { Component, ElementRef } from "@angular/core";
4+
import { dumpView, createDevice } from "./test-utils";
5+
import { TestApp } from "./test-app";
6+
import { DEVICE } from "nativescript-angular/platform-providers";
7+
import { platformNames } from "platform";
98

109
@Component({
1110
template: `
@@ -37,12 +36,12 @@ export class PlatformSpecificAttributeComponent {
3736
constructor(public elementRef: ElementRef) { }
3837
}
3938

40-
describe('Platofrm filter directives', () => {
39+
describe('Platform filter directives', () => {
4140
describe('on IOS device', () => {
4241
let testApp: TestApp = null;
4342

4443
before(() => {
45-
return TestApp.create([{provide: DEVICE, useValue: createDevice(platformNames.ios)}], [PlatformSpecificAttributeComponent, AndroidSpecificComponent, IosSpecificComponent]).then((app) => {
44+
return TestApp.create([{provide: DEVICE, useValue: createDevice(platformNames.ios)}], [PlatformSpecificAttributeComponent, AndroidSpecificComponent, IosSpecificComponent]).then((app) => {
4645
testApp = app;
4746
});
4847
});
@@ -51,21 +50,17 @@ describe('Platofrm filter directives', () => {
5150
testApp.dispose();
5251
});
5352

54-
it("does render ios sepecific conternt", () => {
53+
it("does render ios specific content", () => {
5554
return testApp.loadComponent(IosSpecificComponent).then((componentRef) => {
5655
const componentRoot = componentRef.instance.elementRef.nativeElement;
57-
assert.equal(
58-
"(ProxyViewContainer (StackLayout (ProxyViewContainer (template), (Label[text=IOS]))))",
59-
dumpView(componentRoot, true));
56+
assert.isTrue(dumpView(componentRoot, true).indexOf("(Label[text=IOS])") >= 0);
6057
});
6158
});
6259

63-
it("does not render android sepecific conternt", () => {
60+
it("does not render android specific content", () => {
6461
return testApp.loadComponent(AndroidSpecificComponent).then((componentRef) => {
6562
const componentRoot = componentRef.instance.elementRef.nativeElement;
66-
assert.equal(
67-
"(ProxyViewContainer (StackLayout (ProxyViewContainer (template))))",
68-
dumpView(componentRoot, true));
63+
assert.isTrue(dumpView(componentRoot, true).indexOf("Label") < 0);
6964
});
7065
});
7166

@@ -84,7 +79,7 @@ describe('Platofrm filter directives', () => {
8479
let testApp: TestApp = null;
8580

8681
before(() => {
87-
return TestApp.create([{provide: DEVICE, useValue: createDevice(platformNames.android)}], [AndroidSpecificComponent, IosSpecificComponent, PlatformSpecificAttributeComponent]).then((app) => {
82+
return TestApp.create([{provide: DEVICE, useValue: createDevice(platformNames.android)}], [AndroidSpecificComponent, IosSpecificComponent, PlatformSpecificAttributeComponent]).then((app) => {
8883
testApp = app;
8984
});
9085
});
@@ -93,21 +88,17 @@ describe('Platofrm filter directives', () => {
9388
testApp.dispose();
9489
});
9590

96-
it("does render android sepecific conternt", () => {
91+
it("does render android specific content", () => {
9792
return testApp.loadComponent(AndroidSpecificComponent).then((componentRef) => {
9893
const componentRoot = componentRef.instance.elementRef.nativeElement;
99-
assert.equal(
100-
"(ProxyViewContainer (StackLayout (ProxyViewContainer (template), (Label[text=ANDROID]))))",
101-
dumpView(componentRoot, true));
94+
assert.isTrue(dumpView(componentRoot, true).indexOf("(Label[text=ANDROID])") >= 0);
10295
});
10396
});
10497

105-
it("does not render ios sepecific conternt", () => {
98+
it("does not render ios specific content", () => {
10699
return testApp.loadComponent(IosSpecificComponent).then((componentRef) => {
107100
const componentRoot = componentRef.instance.elementRef.nativeElement;
108-
assert.equal(
109-
"(ProxyViewContainer (StackLayout (ProxyViewContainer (template))))",
110-
dumpView(componentRoot, true));
101+
assert.isTrue(dumpView(componentRoot, true).indexOf("Label") < 0);
111102
});
112103
});
113104

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /