EDIT : Obviously this is outdated, now you provide your guard at the providers
array in an NgModule. Watch other answers or official documentation
For those who still have this error - don't forget to include your AuthGuard service or class to main bootstrap function. And don't forget to import this service before bootstrap runs.
import { bootstrap } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app.component';
import { AuthGuard } from './shared/auth.service';
bootstrap(AppComponent, [
appRouterProviders,
AuthGuard
]);
Angular 2 team did not mention this in main router docs, and it took couple of hours for me to figure it out.