{"action":"created","issue":{"url":"https://api.github.com/repos/angular/router/issues/222","labels_url":"https://api.github.com/repos/angular/router/issues/222/labels{/name}","comments_url":"https://api.github.com/repos/angular/router/issues/222/comments","events_url":"https://api.github.com/repos/angular/router/issues/222/events","html_url":"https://github.com/angular/router/issues/222","id":65251532,"number":222,"title":"How to navigate to nested route from controller?","user":{"login":"kpgarrod","id":2155409,"avatar_url":"https://avatars.githubusercontent.com/u/2155409?v=3","gravatar_id":"","url":"https://api.github.com/users/kpgarrod","html_url":"https://github.com/kpgarrod","followers_url":"https://api.github.com/users/kpgarrod/followers","following_url":"https://api.github.com/users/kpgarrod/following{/other_user}","gists_url":"https://api.github.com/users/kpgarrod/gists{/gist_id}","starred_url":"https://api.github.com/users/kpgarrod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kpgarrod/subscriptions","organizations_url":"https://api.github.com/users/kpgarrod/orgs","repos_url":"https://api.github.com/users/kpgarrod/repos","events_url":"https://api.github.com/users/kpgarrod/events{/privacy}","received_events_url":"https://api.github.com/users/kpgarrod/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/router/labels/type:%20bug","name":"type: bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/angular/router/milestones/14","html_url":"https://github.com/angular/router/milestones/v0.5.3","labels_url":"https://api.github.com/repos/angular/router/milestones/14/labels","id":1045642,"number":14,"title":"v0.5.3","description":"","creator":{"login":"btford","id":474988,"avatar_url":"https://avatars.githubusercontent.com/u/474988?v=3","gravatar_id":"","url":"https://api.github.com/users/btford","html_url":"https://github.com/btford","followers_url":"https://api.github.com/users/btford/followers","following_url":"https://api.github.com/users/btford/following{/other_user}","gists_url":"https://api.github.com/users/btford/gists{/gist_id}","starred_url":"https://api.github.com/users/btford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/btford/subscriptions","organizations_url":"https://api.github.com/users/btford/orgs","repos_url":"https://api.github.com/users/btford/repos","events_url":"https://api.github.com/users/btford/events{/privacy}","received_events_url":"https://api.github.com/users/btford/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":0,"state":"open","created_at":"2015-03-30T21:19:36Z","updated_at":"2015-03-30T21:20:07Z","due_on":"2015-03-31T07:00:00Z","closed_at":null},"comments":3,"created_at":"2015-03-30T16:40:19Z","updated_at":"2015-04-02T14:34:45Z","closed_at":null,"body":"I have an app controller which defines a number of routes:\r\n``` $router.config([\r\n      {path: '/', redirectTo: '/home' },\r\n      {path: '/path1', component: 'component1' },\r\n      {path: '/path2', component: 'component2' }, etc\r\n```\r\ncomponent2 defines it's own subComponents:\r\n\r\n``` $router.config([\r\n      {path: '/subPath1', component: 'component3' },\r\n      {path: '/subPath2', component: 'component4' }, etc\r\n```\r\nThe main page (index.html with ng-controller appController) has an ng-viewport and the template for component2 has an ng-viewport.\r\n \r\nI have a function in appController:\r\n\r\n``` \r\n  function changeState(toComponent) {\r\n    $router.navigate($router.generate(toComponent));\r\n  }\r\n```\r\nIf I pass in 'component1', the router routes correctly.\r\n\r\nI want to be able to navigate from appController to /path2/subPath2 so that component4 is rendered in the viewPort in component2.\r\n\r\nIf I pass in 'component4', nothing happens. There is no error and no change of location.\r\n\r\nIf I remove the $router.generate from the function:\r\n\r\n``` \r\n  function changeState(toPath) {\r\n    $router.navigate(toPath);\r\n  }\r\n```\r\n and pass in '/path2/subPath2' I get an error:\r\n\r\n> TypeError: Cannot read property 'canonicalUrl' of undefined\r\n\r\nAm I doing something wrong? \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/angular/router/issues/comments/88930375","html_url":"https://github.com/angular/router/issues/222#issuecomment-88930375","issue_url":"https://api.github.com/repos/angular/router/issues/222","id":88930375,"user":{"login":"tommck","id":981957,"avatar_url":"https://avatars.githubusercontent.com/u/981957?v=3","gravatar_id":"","url":"https://api.github.com/users/tommck","html_url":"https://github.com/tommck","followers_url":"https://api.github.com/users/tommck/followers","following_url":"https://api.github.com/users/tommck/following{/other_user}","gists_url":"https://api.github.com/users/tommck/gists{/gist_id}","starred_url":"https://api.github.com/users/tommck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommck/subscriptions","organizations_url":"https://api.github.com/users/tommck/orgs","repos_url":"https://api.github.com/users/tommck/repos","events_url":"https://api.github.com/users/tommck/events{/privacy}","received_events_url":"https://api.github.com/users/tommck/received_events","type":"User","site_admin":false},"created_at":"2015-04-02T14:34:45Z","updated_at":"2015-04-02T14:34:45Z","body":"Is this the same problem I run into with trying to create a navigation menu?  \r\n\r\nI have a root controller with a few routes to controllers with their own routes.\r\n\r\nIf I try to set up an <a ng-link=\"component-foo\"> to one of those child routes, the <a> tag goes nowhere.\r\n"}}