dagstuan / ng2-redux-router

Bindings to connect @angular/router to ng2-redux
MIT License
19 stars 11 forks source link

bug in interaction with canactivate function #3

Closed dkostenko closed 8 years ago

dkostenko commented 8 years ago

There is a problem with router function canActivate. If a guard returns false, router doesn't change current URI, but the ng2-redux-router changes the state of Router

Сode example below

Router with canActivate function:

const routes: RouterConfig = [
  {
    path: 'list',
    component: ListPage,
    canActivate: [LoggedInGuard]
  },
];

Guard with canActivate function implementation:

@Injectable()
export class LoggedInGuard implements CanActivate {
    constructor() {}
    canActivate(): boolean {
        return false;
    }
}
dagstuan commented 8 years ago

Thanks for the bug report. This issue should be fixed in 1.0.3, let me know if you're still having problems :)