{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular-cli/issues/287","repository_url":"https://api.github.com/repos/angular/angular-cli","labels_url":"https://api.github.com/repos/angular/angular-cli/issues/287/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular-cli/issues/287/comments","events_url":"https://api.github.com/repos/angular/angular-cli/issues/287/events","html_url":"https://github.com/angular/angular-cli/issues/287","id":139765671,"number":287,"title":"`ng g route` should also add the route to the RouteConfig","user":{"login":"hansl","id":681969,"avatar_url":"https://avatars.githubusercontent.com/u/681969?v=3","gravatar_id":"","url":"https://api.github.com/users/hansl","html_url":"https://github.com/hansl","followers_url":"https://api.github.com/users/hansl/followers","following_url":"https://api.github.com/users/hansl/following{/other_user}","gists_url":"https://api.github.com/users/hansl/gists{/gist_id}","starred_url":"https://api.github.com/users/hansl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hansl/subscriptions","organizations_url":"https://api.github.com/users/hansl/orgs","repos_url":"https://api.github.com/users/hansl/repos","events_url":"https://api.github.com/users/hansl/events{/privacy}","received_events_url":"https://api.github.com/users/hansl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular-cli/labels/command:%20generate","name":"command: generate","color":"c7def8"},{"url":"https://api.github.com/repos/angular/angular-cli/labels/effort:%20(2)%20medium","name":"effort: (2) medium","color":"bfe5bf"},{"url":"https://api.github.com/repos/angular/angular-cli/labels/type:%20enhancement","name":"type: enhancement","color":"eeeeee"}],"state":"open","locked":false,"assignee":{"login":"zackarychapple","id":2133184,"avatar_url":"https://avatars.githubusercontent.com/u/2133184?v=3","gravatar_id":"","url":"https://api.github.com/users/zackarychapple","html_url":"https://github.com/zackarychapple","followers_url":"https://api.github.com/users/zackarychapple/followers","following_url":"https://api.github.com/users/zackarychapple/following{/other_user}","gists_url":"https://api.github.com/users/zackarychapple/gists{/gist_id}","starred_url":"https://api.github.com/users/zackarychapple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackarychapple/subscriptions","organizations_url":"https://api.github.com/users/zackarychapple/orgs","repos_url":"https://api.github.com/users/zackarychapple/repos","events_url":"https://api.github.com/users/zackarychapple/events{/privacy}","received_events_url":"https://api.github.com/users/zackarychapple/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2016-03-10T02:38:00Z","updated_at":"2016-03-15T14:07:11Z","closed_at":null,"body":"Tasklist:\r\n\r\n* [ ] add a `angular-cli/router-config.ts` to the scaffold. This is part of the project. The content of this file should have a comment at the top to say to not touch this file, and export a `CliRouteConfig` (open to name suggestions).\r\n* [ ] add a `README.md` to the `angular-cli` directory to explain that this is generated code. We will use this for other things such as providers and third party libraries.\r\n* [ ] import the `CliRouteConfig` in the default `src/app/__name__.ts`. The code should look something like [1].\r\n* [ ] `ng generate route` needs to add the route info to the `router-config.ts`. This includes importing the new route and adding it to the `CliRouteConfig` array.\r\n* [ ] `ng generate route` should have a flag `--no-route-generation` (open to suggestions) that avoid the addition of it to the `CliRouteConfig` array.\r\n* [ ] `README.md` documentation for this.\r\n* [ ] e2e tests for it.\r\n\r\n----\r\n\r\n[1]\r\n\r\n```typescript\r\n@Component({\r\n  selector: '<%= htmlComponentName %>-app',\r\n  providers: [],\r\n  templateUrl: 'app/<%= htmlComponentName %>.html',\r\n  directives: [ROUTER_DIRECTIVES],\r\n  pipes: []\r\n})\r\n@RouteConfig([\r\n\r\n].concat(CliRouteConfig))\r\nexport class <%= jsComponentName %>App {\r\n  defaultMeaning: number = 42;\r\n  \r\n  meaningOfLife(meaning?: number) {\r\n    return `The meaning of life is ${meaning || this.defaultMeaning}`;\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/angular/angular-cli/issues/comments/196836260","html_url":"https://github.com/angular/angular-cli/issues/287#issuecomment-196836260","issue_url":"https://api.github.com/repos/angular/angular-cli/issues/287","id":196836260,"user":{"login":"filipesilva","id":4172079,"avatar_url":"https://avatars.githubusercontent.com/u/4172079?v=3","gravatar_id":"","url":"https://api.github.com/users/filipesilva","html_url":"https://github.com/filipesilva","followers_url":"https://api.github.com/users/filipesilva/followers","following_url":"https://api.github.com/users/filipesilva/following{/other_user}","gists_url":"https://api.github.com/users/filipesilva/gists{/gist_id}","starred_url":"https://api.github.com/users/filipesilva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/filipesilva/subscriptions","organizations_url":"https://api.github.com/users/filipesilva/orgs","repos_url":"https://api.github.com/users/filipesilva/repos","events_url":"https://api.github.com/users/filipesilva/events{/privacy}","received_events_url":"https://api.github.com/users/filipesilva/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T14:07:11Z","updated_at":"2016-03-15T14:07:11Z","body":"I hadn't thought about that until you asked really! \r\n\r\nI guess the most important bit is that it needs to be something that unambiguously describes something else as the parent. It also needs to specify the relative location (to `./src`) of the parent route, since you can perfectly well have it any depth and even repeated classes.\r\n\r\nThe parent must default to our defined root component.\r\n\r\nAs per @Brocco's work on dynamic paths, it should support specifying a path for the component itself and also default to a certain folder if path isn't specified (both for the generated element and the parent). We should use the helper functions he made for this purpose.\r\n\r\nUsing the normal `ember-cli` command args, then I suppose the most intuitive approach is:\r\n\r\n```\r\nng generate route app/folder1/folder2/Villain --parent=app/folder1/folder2/HeroRoot\r\n```\r\n\r\nWhere the following two should be equivalent:\r\n\r\n```\r\nng generate route Villain\r\nng generate route app/Villain --parent=app/app\r\n```"}}