-
Notifications
You must be signed in to change notification settings - Fork 181
Closed
Labels
Description
After upgrading to @angular/core 2.4.8, @angular/router 3.4.8 the angular2-token Route Guards stop working. It looks like the router is checking the canActivate parameter before the app component calls init on the angular2-token service.
route declaration:
const routes: Routes = [
{
path: '',
redirectTo: 'home',
pathMatch: 'full',
canActivate: [Angular2TokenService]
},
app component:
constructor(
private tokenService: Angular2TokenService,
) {
//configure angular2-token
tokenService.init({
apiPath: 'http://localhost:3000',
//... more parameters
})
}
The page fails to load when it hits the following line of canActivate:
if (this._options.signInStoredUrlStorageKey)
with this._options is undefined. This is because init has not been called yet.
This might be a side effect of #14327
vanslly, MattJustMatt, bluegod, maiyaporn, EGMartins and 1 more