From 0aafbac99b6099d4a72d16ef5b1d65727fda3ecf Mon Sep 17 00:00:00 2001 From: Brandon Roberts Date: Wed, 12 Sep 2018 10:12:41 -0500 Subject: [PATCH] docs: clean up providedIn: 'root' syntax for router examples (#20023) PR Close #20023 --- .../examples/router/src/app/auth/auth.guard.1.ts | 3 +-- .../examples/router/src/app/auth/auth.guard.2.ts | 3 +-- .../examples/router/src/app/auth/auth.guard.3.ts | 2 +- .../examples/router/src/app/auth/auth.guard.4.ts | 2 +- .../examples/router/src/app/auth/auth.guard.ts | 2 +- .../examples/router/src/app/auth/auth.service.ts | 2 +- .../router/src/app/can-deactivate.guard.1.ts | 2 +- .../router/src/app/can-deactivate.guard.ts | 2 +- .../crisis-detail-resolver.service.1.ts | 2 +- .../crisis-detail-resolver.service.ts | 15 +++++++++------ .../src/app/crisis-center/crisis.service.ts | 2 +- .../examples/router/src/app/dialog.service.ts | 2 +- .../app/selective-preloading-strategy.service.ts | 2 +- 13 files changed, 21 insertions(+), 20 deletions(-) diff --git a/aio/content/examples/router/src/app/auth/auth.guard.1.ts b/aio/content/examples/router/src/app/auth/auth.guard.1.ts index a55d52100c..1caa4ef0e7 100644 --- a/aio/content/examples/router/src/app/auth/auth.guard.1.ts +++ b/aio/content/examples/router/src/app/auth/auth.guard.1.ts @@ -1,10 +1,9 @@ // #docregion import { Injectable } from '@angular/core'; import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; -import { Observable } from 'rxjs/Observable'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AuthGuard implements CanActivate { canActivate( diff --git a/aio/content/examples/router/src/app/auth/auth.guard.2.ts b/aio/content/examples/router/src/app/auth/auth.guard.2.ts index 08c289a718..2ce03c8c9f 100644 --- a/aio/content/examples/router/src/app/auth/auth.guard.2.ts +++ b/aio/content/examples/router/src/app/auth/auth.guard.2.ts @@ -1,12 +1,11 @@ // #docregion import { Injectable } from '@angular/core'; import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; -import { Observable } from 'rxjs/Observable'; import { AuthService } from './auth.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AuthGuard implements CanActivate { constructor(private authService: AuthService, private router: Router) {} diff --git a/aio/content/examples/router/src/app/auth/auth.guard.3.ts b/aio/content/examples/router/src/app/auth/auth.guard.3.ts index 5bb0c47a15..97dc4546b4 100644 --- a/aio/content/examples/router/src/app/auth/auth.guard.3.ts +++ b/aio/content/examples/router/src/app/auth/auth.guard.3.ts @@ -9,7 +9,7 @@ import { import { AuthService } from './auth.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AuthGuard implements CanActivate, CanActivateChild { constructor(private authService: AuthService, private router: Router) {} diff --git a/aio/content/examples/router/src/app/auth/auth.guard.4.ts b/aio/content/examples/router/src/app/auth/auth.guard.4.ts index f460682c5f..feca8d2eb0 100644 --- a/aio/content/examples/router/src/app/auth/auth.guard.4.ts +++ b/aio/content/examples/router/src/app/auth/auth.guard.4.ts @@ -11,7 +11,7 @@ import { import { AuthService } from './auth.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AuthGuard implements CanActivate, CanActivateChild { constructor(private authService: AuthService, private router: Router) {} diff --git a/aio/content/examples/router/src/app/auth/auth.guard.ts b/aio/content/examples/router/src/app/auth/auth.guard.ts index da9f79cb2b..8f7d863cc1 100644 --- a/aio/content/examples/router/src/app/auth/auth.guard.ts +++ b/aio/content/examples/router/src/app/auth/auth.guard.ts @@ -11,7 +11,7 @@ import { import { AuthService } from './auth.service'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AuthGuard implements CanActivate, CanActivateChild, CanLoad { constructor(private authService: AuthService, private router: Router) {} diff --git a/aio/content/examples/router/src/app/auth/auth.service.ts b/aio/content/examples/router/src/app/auth/auth.service.ts index 6627d28fd6..280caa14da 100644 --- a/aio/content/examples/router/src/app/auth/auth.service.ts +++ b/aio/content/examples/router/src/app/auth/auth.service.ts @@ -5,7 +5,7 @@ import { Observable, of } from 'rxjs'; import { tap, delay } from 'rxjs/operators'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class AuthService { isLoggedIn = false; diff --git a/aio/content/examples/router/src/app/can-deactivate.guard.1.ts b/aio/content/examples/router/src/app/can-deactivate.guard.1.ts index 45ccd1726d..b490093d42 100644 --- a/aio/content/examples/router/src/app/can-deactivate.guard.1.ts +++ b/aio/content/examples/router/src/app/can-deactivate.guard.1.ts @@ -8,7 +8,7 @@ import { CanDeactivate, import { CrisisDetailComponent } from './crisis-center/crisis-detail/crisis-detail.component'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CanDeactivateGuard implements CanDeactivate { diff --git a/aio/content/examples/router/src/app/can-deactivate.guard.ts b/aio/content/examples/router/src/app/can-deactivate.guard.ts index 1c947440a3..41a93a2af4 100644 --- a/aio/content/examples/router/src/app/can-deactivate.guard.ts +++ b/aio/content/examples/router/src/app/can-deactivate.guard.ts @@ -8,7 +8,7 @@ export interface CanComponentDeactivate { } @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CanDeactivateGuard implements CanDeactivate { canDeactivate(component: CanComponentDeactivate) { diff --git a/aio/content/examples/router/src/app/crisis-center/crisis-detail-resolver.service.1.ts b/aio/content/examples/router/src/app/crisis-center/crisis-detail-resolver.service.1.ts index ded64f12cd..c87b9343fc 100644 --- a/aio/content/examples/router/src/app/crisis-center/crisis-detail-resolver.service.1.ts +++ b/aio/content/examples/router/src/app/crisis-center/crisis-detail-resolver.service.1.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CrisisDetailResolverService { diff --git a/aio/content/examples/router/src/app/crisis-center/crisis-detail-resolver.service.ts b/aio/content/examples/router/src/app/crisis-center/crisis-detail-resolver.service.ts index b801f9ead9..eed3b2a190 100644 --- a/aio/content/examples/router/src/app/crisis-center/crisis-detail-resolver.service.ts +++ b/aio/content/examples/router/src/app/crisis-center/crisis-detail-resolver.service.ts @@ -1,16 +1,19 @@ // #docregion import { Injectable } from '@angular/core'; -import { Router, Resolve, RouterStateSnapshot, - ActivatedRouteSnapshot } from '@angular/router'; -import { Observable, of, EMPTY as empty } from 'rxjs'; -import { mergeMap, take } from 'rxjs/operators'; +import { + Router, Resolve, + RouterStateSnapshot, + ActivatedRouteSnapshot +} from '@angular/router'; +import { Observable, of, EMPTY } from 'rxjs'; +import { mergeMap, take } from 'rxjs/operators'; import { CrisisService } from './crisis.service'; import { Crisis } from './crisis'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CrisisDetailResolverService implements Resolve { constructor(private cs: CrisisService, private router: Router) {} @@ -25,7 +28,7 @@ export class CrisisDetailResolverService implements Resolve { return of(crisis); } else { // id not found this.router.navigate(['/crisis-center']); - return empty; + return EMPTY; } }) ); diff --git a/aio/content/examples/router/src/app/crisis-center/crisis.service.ts b/aio/content/examples/router/src/app/crisis-center/crisis.service.ts index 417ed49d34..a1ebc42256 100644 --- a/aio/content/examples/router/src/app/crisis-center/crisis.service.ts +++ b/aio/content/examples/router/src/app/crisis-center/crisis.service.ts @@ -9,7 +9,7 @@ import { Crisis } from './crisis'; import { CRISES } from './mock-crises'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class CrisisService { static nextCrisisId = 100; diff --git a/aio/content/examples/router/src/app/dialog.service.ts b/aio/content/examples/router/src/app/dialog.service.ts index 218822bc0e..e0ed6760cb 100644 --- a/aio/content/examples/router/src/app/dialog.service.ts +++ b/aio/content/examples/router/src/app/dialog.service.ts @@ -8,7 +8,7 @@ import { Observable, of } from 'rxjs'; * TODO: better modal implementation that doesn't use window.confirm */ @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class DialogService { /** diff --git a/aio/content/examples/router/src/app/selective-preloading-strategy.service.ts b/aio/content/examples/router/src/app/selective-preloading-strategy.service.ts index b1065b78af..a22ac0227e 100644 --- a/aio/content/examples/router/src/app/selective-preloading-strategy.service.ts +++ b/aio/content/examples/router/src/app/selective-preloading-strategy.service.ts @@ -4,7 +4,7 @@ import { PreloadingStrategy, Route } from '@angular/router'; import { Observable, of } from 'rxjs'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class SelectivePreloadingStrategyService implements PreloadingStrategy { preloadedModules: string[] = [];