diff --git a/modules/@angular/router/src/router.ts b/modules/@angular/router/src/router.ts index 8f66bada39..8ca4400262 100644 --- a/modules/@angular/router/src/router.ts +++ b/modules/@angular/router/src/router.ts @@ -13,13 +13,13 @@ import 'rxjs/add/operator/reduce'; import 'rxjs/add/operator/every'; import 'rxjs/add/observable/from'; import 'rxjs/add/observable/forkJoin'; +import 'rxjs/add/observable/of'; import {Location} from '@angular/common'; import {AppModuleFactoryLoader, ComponentFactoryResolver, ComponentResolver, Injector, ReflectiveInjector, Type} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import {Subject} from 'rxjs/Subject'; import {Subscription} from 'rxjs/Subscription'; -import {of } from 'rxjs/observable/of'; import {applyRedirects} from './apply_redirects'; import {ResolveData, Routes, validateConfig} from './config'; @@ -347,7 +347,7 @@ export class Router { if (shouldActivate) { return preActivation.resolveData().map(() => shouldActivate); } else { - return of (shouldActivate); + return Observable.of(shouldActivate); } }) @@ -413,7 +413,7 @@ class PreActivation { } checkGuards(): Observable { - if (this.checks.length === 0) return of (true); + if (this.checks.length === 0) return Observable.of(true); return Observable.from(this.checks) .map(s => { if (s instanceof CanActivate) { @@ -431,13 +431,13 @@ class PreActivation { } resolveData(): Observable { - if (this.checks.length === 0) return of (null); + if (this.checks.length === 0) return Observable.of(null); return Observable.from(this.checks) .mergeMap(s => { if (s instanceof CanActivate) { return this.runResolve(s.route); } else { - return of (null); + return Observable.of(null); } }) .reduce((_, __) => _); @@ -518,7 +518,7 @@ class PreActivation { private runCanActivate(future: ActivatedRouteSnapshot): Observable { const canActivate = future._routeConfig ? future._routeConfig.canActivate : null; - if (!canActivate || canActivate.length === 0) return of (true); + if (!canActivate || canActivate.length === 0) return Observable.of(true); return Observable.from(canActivate) .map(c => { const guard = this.injector.get(c); @@ -534,7 +534,7 @@ class PreActivation { private runCanDeactivate(component: Object, curr: ActivatedRouteSnapshot): Observable { const canDeactivate = curr && curr._routeConfig ? curr._routeConfig.canDeactivate : null; - if (!canDeactivate || canDeactivate.length === 0) return of (true); + if (!canDeactivate || canDeactivate.length === 0) return Observable.of(true); return Observable.from(canDeactivate) .map(c => { const guard = this.injector.get(c); @@ -571,7 +571,7 @@ function wrapIntoObservable(value: T | Observable): Observable { if (value instanceof Observable) { return value; } else { - return of (value); + return Observable.of(value); } }