I've just recently moved to ngrx's router from angular2's router. Also, I am using angular 2 rc4.
my routes look like this:
export const: Routes = [
{path: "appRoute1", component: "appComponent1", guards: [HashGuard, hasSelectedGuard]},
{path: "appRoute2", component: "appComponent2", guards: [HashGuard, hasSelectedGuard]},
]
HashGuard only has one function (and a constructor):
protectRoute(candidate : TravesalCandidate){
if (!window.location.hash){
this.router.go(HOME_ADDRESS);
}
return Observable.of(true);
}
similarly, HasSelectedGuard has only one function:
protectRoute(candidate : TravesalCandidate){
if (!this.currentSelectionService.hasSelectedPerson()){
this.router.go(HOME_ADDRESS);
return Observable.of(false);
}
return Observable.of(true)
}
I am bootstrapping whatever's needed, as I should have:
bootstrap(AppComponent, [
provideRouter(routes, HashLocationStrategy),
Router,
HashGuard,
CurrentSelectionService
]
I have a sidemenu component with multiple links, along others I have appRoute1 and appRoute2:
<a [linkTo]="'/appRoute1'"> ... </a>
<a [linkTo]="'/appRoute2'"> ... </a>
When I click one of the links the URL changes as supposed to, but the page itself does not load (no requests are sent after the click and the component's constructor is not
Help is gladly appreciated.