Skip to content

Commit 29f2d0e

Browse files
aitboudadchristopherthielen
authored andcommitted
upgrade to angular 4.
1 parent c5b722f commit 29f2d0e

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@
5151
"@uirouter/rx": "=0.3.1"
5252
},
5353
"peerDependencies": {
54-
"@angular/common": "^2.3.1",
55-
"@angular/core": "^2.3.1",
56-
"@angular/router": "^3.3.1"
54+
"@angular/common": "^4.0.0",
55+
"@angular/core": "^4.0.0",
56+
"@angular/router": "^4.0.0"
5757
},
5858
"devDependencies": {
59-
"@angular/common": "^2.3.1",
60-
"@angular/compiler": "^2.3.1",
61-
"@angular/compiler-cli": "^2.3.1",
62-
"@angular/core": "^2.3.1",
63-
"@angular/platform-browser": "^2.3.1",
64-
"@angular/platform-browser-dynamic": "^2.3.1",
65-
"@angular/platform-server": "^2.3.1",
66-
"@angular/router": "^3.3.1",
59+
"@angular/common": "^4.0.0",
60+
"@angular/compiler": "^4.0.0",
61+
"@angular/compiler-cli": "^4.0.0",
62+
"@angular/core": "^4.0.0",
63+
"@angular/platform-browser": "^4.0.0",
64+
"@angular/platform-browser-dynamic": "^4.0.0",
65+
"@angular/platform-server": "^4.0.0",
66+
"@angular/router": "^4.0.0",
6767
"@types/jasmine": "^2.2.34",
6868
"@types/jquery": "^1.10.31",
6969
"awesome-typescript-loader": "^3.1.2",
@@ -98,7 +98,7 @@
9898
"typedoc-plugin-external-module-name": "^1.0.2",
9999
"typedoc-plugin-internal-external": "^1.0.0",
100100
"typedoc-plugin-ui-router": "^1.0.0",
101-
"typescript": "^2.1.4",
101+
"typescript": "^2.2.0",
102102
"ui-router-typedoc-themes": "^1.0.0",
103103
"webpack": "^2.2.0",
104104
"webpack-dev-server": "2.2.0",

src/directives/uiView.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
Component, ComponentFactoryResolver, ViewContainerRef, Input, ComponentRef, Type, ReflectiveInjector, ViewChild,
55
Injector, Inject
66
} from '@angular/core';
7-
import { reflector } from '../private_import_core';
7+
import { ɵReflectorReader as ReflectorReader } from '@angular/core';
88
import {
99
UIRouter, isFunction, Transition, parse, TransitionHookFn, StateDeclaration, inArray, trace, ViewContext, ViewConfig,
1010
ActiveUIView, ResolveContext, NATIVE_INJECTOR_TOKEN, flattenR
@@ -35,7 +35,7 @@ interface InputMapping {
3535
*
3636
* @internalapi
3737
*/
38-
const ng2ComponentInputs = (ng2CompClass: Type<any>, component: any) => {
38+
const ng2ComponentInputs = (reflector: ReflectorReader, ng2CompClass: Type<any>, component: any) => {
3939
/** Get "@Input('foo') _foo" inputs */
4040
let props = reflector.propMetadata(ng2CompClass);
4141
let _props = Object.keys(props || {})
@@ -109,7 +109,7 @@ const ng2ComponentInputs = (ng2CompClass: Type<any>, component: any) => {
109109
@Component({
110110
selector: 'ui-view, [ui-view]',
111111
template: `
112-
<template #componentTarget></template>
112+
<ng-template #componentTarget></ng-template>
113113
<ng-content *ngIf="!componentRef"></ng-content>
114114
`
115115
// styles: [`
@@ -148,7 +148,8 @@ export class UIView {
148148
constructor(
149149
public router: UIRouter,
150150
@Inject(UIView.PARENT_INJECT) parent,
151-
public viewContainerRef: ViewContainerRef
151+
public viewContainerRef: ViewContainerRef,
152+
private reflector: ReflectorReader
152153
) {
153154
this.parent = parent;
154155
}
@@ -286,7 +287,7 @@ export class UIView {
286287
const explicitInputTuples = explicitBoundProps
287288
.reduce((acc, key) => acc.concat([{ prop: key, token: bindings[key] }]), []);
288289

289-
const implicitInputTuples = ng2ComponentInputs(componentClass, component)
290+
const implicitInputTuples = ng2ComponentInputs(this.reflector, componentClass, component)
290291
.filter(tuple => !inArray(explicitBoundProps, tuple.prop));
291292

292293
const addResolvable = (tuple: InputMapping) => ({

src/providers.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,7 @@ import { Ng2LocationConfig } from "./location/locationConfig";
108108
* Creates a UIRouter instance and configures it for Angular, then invokes router bootstrap.
109109
* This function is used as an Angular `useFactory` Provider.
110110
*/
111-
export function uiRouterFactory(locationStrategy: LocationStrategy, injector: Injector) {
112-
let rootModules: RootModule[] = injector.get(UIROUTER_ROOT_MODULE);
113-
let modules: StatesModule[] = injector.get(UIROUTER_MODULE_TOKEN);
114-
111+
export function uiRouterFactory(locationStrategy: LocationStrategy, rootModules: RootModule[], modules: StatesModule[], injector: Injector) {
115112
if (rootModules.length !== 1) {
116113
throw new Error("Exactly one UIRouterModule.forRoot() should be in the bootstrapped app module's imports: []");
117114
}
@@ -168,7 +165,7 @@ export function uiRouterFactory(locationStrategy: LocationStrategy, injector: In
168165
export function parentUIViewInjectFactory(r: StateRegistry) { return { fqn: null, context: r.root() } as ParentUIViewInject; }
169166

170167
export const _UIROUTER_INSTANCE_PROVIDERS: Provider[] = [
171-
{ provide: UIRouter, useFactory: uiRouterFactory, deps: [LocationStrategy, Injector] },
168+
{ provide: UIRouter, useFactory: uiRouterFactory, deps: [LocationStrategy, UIROUTER_ROOT_MODULE, UIROUTER_MODULE_TOKEN, Injector] },
172169
{ provide: UIView.PARENT_INJECT, useFactory: parentUIViewInjectFactory, deps: [StateRegistry]},
173170
];
174171

src/uiRouterNgModule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { UIView } from "./directives/uiView";
1010
import { UrlRuleHandlerFn, TargetState, TargetStateDef, UIRouter } from "@uirouter/core";
1111
import { _UIROUTER_INSTANCE_PROVIDERS, _UIROUTER_SERVICE_PROVIDERS } from "./providers";
1212

13-
import { ROUTES } from "@angular/router/src/router_config_loader";
13+
import { ROUTES } from "@angular/router";
1414
/** @hidden */ export const UIROUTER_ROOT_MODULE = new OpaqueToken("UIRouter Root Module");
1515
/** @hidden */ export const UIROUTER_MODULE_TOKEN = new OpaqueToken("UIRouter Module");
1616
/** @hidden */ export const UIROUTER_STATES = new OpaqueToken("UIRouter States");

0 commit comments

Comments
 (0)