{"action":"created","issue":{"url":"https://api.github.com/repos/angular/universal-starter/issues/109","repository_url":"https://api.github.com/repos/angular/universal-starter","labels_url":"https://api.github.com/repos/angular/universal-starter/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/angular/universal-starter/issues/109/comments","events_url":"https://api.github.com/repos/angular/universal-starter/issues/109/events","html_url":"https://github.com/angular/universal-starter/issues/109","id":161008707,"number":109,"title":"Error: using RouteParams","user":{"login":"kuldeepkeshwar","id":10448534,"avatar_url":"https://avatars.githubusercontent.com/u/10448534?v=3","gravatar_id":"","url":"https://api.github.com/users/kuldeepkeshwar","html_url":"https://github.com/kuldeepkeshwar","followers_url":"https://api.github.com/users/kuldeepkeshwar/followers","following_url":"https://api.github.com/users/kuldeepkeshwar/following{/other_user}","gists_url":"https://api.github.com/users/kuldeepkeshwar/gists{/gist_id}","starred_url":"https://api.github.com/users/kuldeepkeshwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kuldeepkeshwar/subscriptions","organizations_url":"https://api.github.com/users/kuldeepkeshwar/orgs","repos_url":"https://api.github.com/users/kuldeepkeshwar/repos","events_url":"https://api.github.com/users/kuldeepkeshwar/events{/privacy}","received_events_url":"https://api.github.com/users/kuldeepkeshwar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-06-18T05:51:40Z","updated_at":"2016-06-21T12:54:45Z","closed_at":null,"body":"I'm getting below error when I try to use `RouteParams`\r\n\r\n```\r\nEXCEPTION: TypeError: Cannot read property 'isSkipSelf' of null\r\nngOnInit Error: [TypeError: Cannot read property 'isSkipSelf' of null]\r\nAsync Error: [TypeError: Cannot read property 'map' of undefined]\r\npreboot Error: [TypeError: Cannot read property 'length' of undefined]\r\nRendering Document Error: [TypeError: Cannot read property '0' of undefined]\r\n/favicon.ico\r\nEXCEPTION: TypeError: Cannot read property 'isSkipSelf' of null\r\nngOnInit Error: [TypeError: Cannot read property 'isSkipSelf' of null]\r\nAsync Error: [TypeError: Cannot read property 'map' of undefined]\r\npreboot Error: [TypeError: Cannot read property 'length' of undefined]\r\nRendering Document Error: [TypeError: Cannot read property '0' of undefined]\r\n```\r\n\r\nCode: \r\n\r\n```\r\nimport {Component,OnInit} from '@angular/core';\r\nimport {ROUTER_DIRECTIVES,RouteParams} from \"@angular/router-deprecated\";\r\n\r\n@Component({\r\n  moduleId:module.id,\r\n  selector: 'header',\r\n  directives: [\r\n    ROUTER_DIRECTIVES\r\n  ],\r\n  styles: [require('./header.component.scss')],\r\n  template: require('./header.component.html'),\r\n  providers:[RouteParams]\r\n})\r\nexport class Header implements OnInit{\r\ndivision:string=null;\r\n  constructor(private _routeParams:RouteParams){} // works fine if we comment the constructor and hardcode division\r\n  ngOnInit() {\r\n    //this.division='test';\r\n    this.division=this._routeParams.get('division'); // need to read value of division from route params\r\n  }\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/angular/universal-starter/issues/comments/227430465","html_url":"https://github.com/angular/universal-starter/issues/109#issuecomment-227430465","issue_url":"https://api.github.com/repos/angular/universal-starter/issues/109","id":227430465,"user":{"login":"MarkPieszak","id":2574412,"avatar_url":"https://avatars.githubusercontent.com/u/2574412?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkPieszak","html_url":"https://github.com/MarkPieszak","followers_url":"https://api.github.com/users/MarkPieszak/followers","following_url":"https://api.github.com/users/MarkPieszak/following{/other_user}","gists_url":"https://api.github.com/users/MarkPieszak/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkPieszak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkPieszak/subscriptions","organizations_url":"https://api.github.com/users/MarkPieszak/orgs","repos_url":"https://api.github.com/users/MarkPieszak/repos","events_url":"https://api.github.com/users/MarkPieszak/events{/privacy}","received_events_url":"https://api.github.com/users/MarkPieszak/received_events","type":"User","site_admin":false},"created_at":"2016-06-21T12:54:45Z","updated_at":"2016-06-21T12:54:45Z","body":"Hey @kuldeepkeshwar, I believe it's because you are passing in `RouteParams` under your list of **Providers**, so Universal is trying to DI it, causing the error. You actually don't need to pass it there.\r\n\r\nJust remove that `providers: [RouteParams]`, and the error will go away.\r\n\r\nUse it like normal after that:\r\n\r\n```\r\n  constructor(private _routeParams: RouteParams) { }\r\n\r\n  ngOnInit () {\r\n    console.log(this._routeParams.get('division')); // <-- \r\n  }\r\n```\r\n\r\nJust tried, both server & client saw the params logged."}}
{"actor":{"display_login":"MarkPieszak"}}