I'm using Angular 2 rc4 and I've used the new routing like this
const routes: RouterConfig = [{
path: '',
component: PublicLayoutComponent,
children: [
{ path: '', component: HomeComponent},
{ path: 'login', component: LoginComponent}
]
}]
for this code i cannot access the route /login
I just want to know what's wrong it's always redirect to the root, please help
Best Answer
This is an old thread - but no answer yet. If it helps anybody - I found that for my case by adding this to the RouterModule.forRoot options:
Angular.io router docs
I then found that a nested component was throwing an exception. After fixing, my routing worked. What was happening was that the routing was working it was just blowing up when it reached the load of that 1 component so angular just quits the page load and defaults to base URL. This is presumably for security reasons in case your failing component is affecting in page security?