angular / router

The Angular 1 Component Router
MIT License
665 stars 135 forks source link

Nested routes not working anymore #383

Open jdutheil opened 8 years ago

jdutheil commented 8 years ago

Hi everybody,

I'm using nested routes in order to make my application more clear, i.e. for example :

Home route is '/dashboard' ContactComponent defines routes prefixed by '/contact', for example '/contact/list'

I need to link to child routes directly from my dashboard ; it worked well some weeks ago, but now I get this error : "EXCEPTION: Link "["Contact"]" does not resolve to a terminal instruction. in [null]"

Some codes :

app routing

@RouteConfig([
    { path: '/', component: DashboardComponent, as: 'Dashboard' },
    { path: '/contact/...', component: ContactComponent, as: 'Contact' },
    { path: '/template/...', component: TemplateComponent, as: 'Template' }
])

contact routing

@RouteConfig([
    { path: '/', redirectTo: '/list' },
    { path: '/list', component: ContactListComponent, as: 'ContactList' },
    { path: '/create', component: ContactCreateComponent, as: 'ContactCreate' }
])

call that broke the app

<a [router-link]="['./Contact']">---</a>
jdutheil commented 8 years ago

For previous example, I can simply add the real route in second parameter ; other problem is when I have nested routes in nested routes :

template

@RouteConfig([
    { path: '/', redirectTo: '/contact' },
    { path: '/contact/...', component: TemplateContactComponent, as: 'TemplateContact' }
])

template contact

@RouteConfig([
    { path: '/', redirectTo: '/form' },
    { path: '/form', component: TemplateContactFormComponent, as: 'TemplateContactForm' }
])

not working ̀html <a [router-link]="['/Template', 'TemplateContact']">--- ̀

pdeva commented 8 years ago

@jdutheil seems like this is a huge flaw with angular 2 that makes it useless for anything more than toy apps https://github.com/angular/angular/issues/6204