Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Style Guide - Use {file}.guard.ts for route guards #1721

@brandonroberts

Description

@brandonroberts

Why

  • Guards are essentially services used by the router
  • Provides standard naming convention for generation

auth.guard.ts

import { Injectable }             from '@angular/core';
import { CanActivate,
         ActivatedRouteSnapshot,
         RouterStateSnapshot }    from '@angular/router';

@Injectable()
export class AuthGuard implements CanActivate {
  canActivate(
    next:  ActivatedRouteSnapshot,
    state: RouterStateSnapshot
  ): Observable<boolean> | boolean {
    return Observable.of(true);
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions