{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/10132","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/10132/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/10132/comments","events_url":"https://api.github.com/repos/angular/angular/issues/10132/events","html_url":"https://github.com/angular/angular/issues/10132","id":166041786,"number":10132,"title":"Cannot compile RouterModule with compiler-cli","user":{"login":"laco0416","id":1529180,"avatar_url":"https://avatars.githubusercontent.com/u/1529180?v=3","gravatar_id":"","url":"https://api.github.com/users/laco0416","html_url":"https://github.com/laco0416","followers_url":"https://api.github.com/users/laco0416/followers","following_url":"https://api.github.com/users/laco0416/following{/other_user}","gists_url":"https://api.github.com/users/laco0416/gists{/gist_id}","starred_url":"https://api.github.com/users/laco0416/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laco0416/subscriptions","organizations_url":"https://api.github.com/users/laco0416/orgs","repos_url":"https://api.github.com/users/laco0416/repos","events_url":"https://api.github.com/users/laco0416/events{/privacy}","received_events_url":"https://api.github.com/users/laco0416/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular/labels/comp:%20router","name":"comp: router","color":"c7def8"},{"url":"https://api.github.com/repos/angular/angular/labels/type:%20bug","name":"type: bug","color":"EEEEEE"}],"state":"closed","locked":false,"assignee":{"login":"vsavkin","id":35996,"avatar_url":"https://avatars.githubusercontent.com/u/35996?v=3","gravatar_id":"","url":"https://api.github.com/users/vsavkin","html_url":"https://github.com/vsavkin","followers_url":"https://api.github.com/users/vsavkin/followers","following_url":"https://api.github.com/users/vsavkin/following{/other_user}","gists_url":"https://api.github.com/users/vsavkin/gists{/gist_id}","starred_url":"https://api.github.com/users/vsavkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsavkin/subscriptions","organizations_url":"https://api.github.com/users/vsavkin/orgs","repos_url":"https://api.github.com/users/vsavkin/repos","events_url":"https://api.github.com/users/vsavkin/events{/privacy}","received_events_url":"https://api.github.com/users/vsavkin/received_events","type":"User","site_admin":false},"assignees":[{"login":"vsavkin","id":35996,"avatar_url":"https://avatars.githubusercontent.com/u/35996?v=3","gravatar_id":"","url":"https://api.github.com/users/vsavkin","html_url":"https://github.com/vsavkin","followers_url":"https://api.github.com/users/vsavkin/followers","following_url":"https://api.github.com/users/vsavkin/following{/other_user}","gists_url":"https://api.github.com/users/vsavkin/gists{/gist_id}","starred_url":"https://api.github.com/users/vsavkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsavkin/subscriptions","organizations_url":"https://api.github.com/users/vsavkin/orgs","repos_url":"https://api.github.com/users/vsavkin/repos","events_url":"https://api.github.com/users/vsavkin/events{/privacy}","received_events_url":"https://api.github.com/users/vsavkin/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2016-07-18T08:19:30Z","updated_at":"2016-07-26T01:11:50Z","closed_at":"2016-07-26T01:04:56Z","body":"**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[x] bug report\r\n[ ] feature request\r\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n**Current behavior**\r\n\r\nWhen I try to compile the code below, an error occurs.\r\n\r\n```ts\r\n@AppModule({\r\n    modules: [BrowserModule, RouterModule],\r\n    providers: [\r\n        ...provideRoutes(APP_ROUTES),\r\n    ],\r\n    precompile: [AppComponent, HeroDetailComponent]\r\n})\r\nexport class MainModule {\r\n    constructor(public appRef: ApplicationRef) {\r\n        appRef.bootstrap(AppComponent)\r\n    }\r\n}\r\n```\r\n\r\n```\r\nerror: Error encountered resolving symbol values statically. Function calls are not supported. \r\nConsider replacing the function or lambda with a reference to an exported function (position 39:40 in the original .ts file), \r\nresolving symbol ROUTER_PROVIDERS in /Users/laco/Works/ng2-compiler-test2/node_modules/@angular/router/src/router_module.d.ts, \r\nresolving symbol RouterModule in /Users/laco/Works/ng2-compiler-test2/node_modules/@angular/router/src/router_module.d.ts, \r\nresolving symbol RouterModule in /Users/laco/Works/ng2-compiler-test2/node_modules/@angular/router/src/router_module.d.ts\r\n```\r\n\r\nThe reason is [this line](https://github.com/angular/angular/blob/master/modules/%40angular/router/src/router_module.ts#L39):\r\n\r\n```ts\r\n {provide: ActivatedRoute, useFactory: (r: Router) => r.routerState.root, deps: [Router]},\r\n``` \r\n\r\ncompiler-cli doesn't support unnamed functions. It should be written with an exported function as well as `Router` with `setupRouter`: \r\n\r\n```ts\r\n{provide: UrlSerializer, useClass: DefaultUrlSerializer}, {\r\n    provide: Router,\r\n    useFactory: setupRouter,\r\n    deps: [\r\n      ApplicationRef, ComponentResolver, UrlSerializer, RouterOutletMap, Location, Injector,\r\n      AppModuleFactoryLoader, ROUTES, ROUTER_CONFIGURATION\r\n    ]\r\n  },\r\n```\r\n\r\n**Expected/desired behavior**\r\n\r\nThat should be compiled well.\r\n\r\n**Reproduction of the problem**\r\nIf the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).\r\n\r\n\r\n\r\n**What is the expected behavior?**\r\n\r\n\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\n\r\n\r\n\r\n**Please tell us about your environment:**\r\n\r\n* **Angular version:** *-builds (latest builds)\r\n \r\n* **Browser:** [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] \r\n \r\n* **Language:** [TypeScript 1.9.0-dev] \r\n\r\ncc/ @vsavkin \r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/235134032","html_url":"https://github.com/angular/angular/issues/10132#issuecomment-235134032","issue_url":"https://api.github.com/repos/angular/angular/issues/10132","id":235134032,"user":{"login":"laco0416","id":1529180,"avatar_url":"https://avatars.githubusercontent.com/u/1529180?v=3","gravatar_id":"","url":"https://api.github.com/users/laco0416","html_url":"https://github.com/laco0416","followers_url":"https://api.github.com/users/laco0416/followers","following_url":"https://api.github.com/users/laco0416/following{/other_user}","gists_url":"https://api.github.com/users/laco0416/gists{/gist_id}","starred_url":"https://api.github.com/users/laco0416/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laco0416/subscriptions","organizations_url":"https://api.github.com/users/laco0416/orgs","repos_url":"https://api.github.com/users/laco0416/repos","events_url":"https://api.github.com/users/laco0416/events{/privacy}","received_events_url":"https://api.github.com/users/laco0416/received_events","type":"User","site_admin":false},"created_at":"2016-07-26T01:11:50Z","updated_at":"2016-07-26T01:11:50Z","body":"Thank you!"}}
{"actor":{"display_login":"laco0416"}}