Working with child routes in the new component router

225 views
Skip to first unread message

kfirgez

unread,
May 29, 2016, 2:59:14 AM5/29/16
to AngularJS
I'm trying to change the beta router to the new component router,
my project started from the official angular2 seed: https://github.com/angular/angular2-seed

I have these routes configured in the main seed-app.ts file:
@Routes([
  { path: '/home',       component: Home},
  { path: '/about',      component: About},
  { path: '/github/...', component: RepoBrowser},
])
And these routes in the repo-browser.ts file:
@Routes([
  {path: '/:org',       component: RepoList},
  {path: '/:org/:name', component: RepoDetail },
])

The problem is that I can't link into the repo route, all the normal routes work but this line doesnt:
<a [routerLink]=" ['/github/repo-list', {org: 'angular'}] ">
      Github Repos
    </a>

I get this error: EXCEPTION: Error: Uncaught (in promise): Cannot match any routes. Current segment: 'github'. Available routes: ['/home', '/about', '/github/...'].

What is the right way to link into a child route with the new component router? (and setting some variables on it like org:angular)
Thanks in advance 

Sander Elias

unread,
May 30, 2016, 3:40:23 AM5/30/16
to AngularJS
Hi Kfirgez,

Are you, (or is that seed) using the deprecated router, or the new one? (both have still issue sin this area, one of them will get those fixed;))

Regards
Sander

kfirgez

unread,
May 30, 2016, 3:49:33 AM5/30/16
to AngularJS
I was trying to use the new router, with the beta(deprecated) router it actually works

Sander Elias

unread,
May 30, 2016, 4:43:27 AM5/30/16
to AngularJS
Ok, there is still a lot of work going on in this area. A new RC is expected within the next 7 day's (No official word on this, just gossip, and educated guesses ;))
I think a lot of those issues will be addressed in that. 

Regards
Sander

kfirgez

unread,
May 30, 2016, 5:39:50 AM5/30/16
to AngularJS
Oh I see thanks! :)
Reply all
Reply to author
Forward
0 new messages