Skip to content

Instantly share code, notes, and snippets.

@sonicoder86
Created June 24, 2016 10:58
Show Gist options
  • Save sonicoder86/6069559dcb05ff14e513930feed2e091 to your computer and use it in GitHub Desktop.
Save sonicoder86/6069559dcb05ff14e513930feed2e091 to your computer and use it in GitHub Desktop.
Upgrading to the new Angular 2 router - part 10
// components/hero-detail/hero-detail.component.ts
import { Component } from '@angular/core';
import { CanActivate, ComponentInstruction } from '@angular/router-deprecated';
@Component({ ... })
@CanActivate((next: ComponentInstruction, prev: ComponentInstruction) => {
return isAuthTokenValid();
})
export class HeroDetailComponent { ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment