{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/12767","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/12767/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/12767/comments","events_url":"https://api.github.com/repos/angular/angular/issues/12767/events","html_url":"https://github.com/angular/angular/issues/12767","id":188028272,"number":12767,"title":"Router data should always be available to children components ","user":{"login":"michaelchiche","id":371278,"avatar_url":"https://avatars3.githubusercontent.com/u/371278?v=4","gravatar_id":"","url":"https://api.github.com/users/michaelchiche","html_url":"https://github.com/michaelchiche","followers_url":"https://api.github.com/users/michaelchiche/followers","following_url":"https://api.github.com/users/michaelchiche/following{/other_user}","gists_url":"https://api.github.com/users/michaelchiche/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelchiche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelchiche/subscriptions","organizations_url":"https://api.github.com/users/michaelchiche/orgs","repos_url":"https://api.github.com/users/michaelchiche/repos","events_url":"https://api.github.com/users/michaelchiche/events{/privacy}","received_events_url":"https://api.github.com/users/michaelchiche/received_events","type":"User","site_admin":false},"labels":[{"id":375500771,"url":"https://api.github.com/repos/angular/angular/labels/comp:%20router","name":"comp: router","color":"c7def8","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2016-11-08T15:51:45Z","updated_at":"2017-10-06T19:42:24Z","closed_at":"2016-11-14T23:06:04Z","author_association":"CONTRIBUTOR","body":"<!--\r\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING\r\n-->\r\n\r\n**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[x] bug report => search github for a similar issue or PR before submitting\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\nIf a route with an empty path shares data to its children, the data is inherited and we can access the data from the resolver and the data of the route, but, if we have a route with a path, the children don't have access to the route data nor its params.\r\n\r\nIt looks like the data is being consumed by the parents. So the parent can see the data, but its children cannot.\r\n\r\nTo better understand what I mean, please look at the plunkers provided in the issue.\r\n\r\n**Expected behavior**\r\nThe parent component should not consume the data, so that its children can get the same data.\r\n\r\n**Minimal reproduction of the problem with instructions**\r\n\r\nhttp://plnkr.co/edit/zpmMLC?p=preview \r\n\r\nvs \r\n\r\nhttp://plnkr.co/edit/wGd3ri?p=preview\r\n\r\n\r\n**What is the motivation / use case for changing the behavior?**\r\n<!-- Describe the motivation or the concrete use case -->\r\n\r\n**Please tell us about your environment:**\r\n<!-- Operating system, IDE, package manager, HTTP server, ... -->\r\n\r\n* **Angular version:** 2.0.X\r\n<!-- Check whether this is still an issue in the most recent Angular version -->\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<!-- All browsers where this could be reproduced -->\r\n \r\n* **Language:** [all | TypeScript X.X | ES6/7 | ES5]\r\n\r\n* **Node (for AoT issues):** `node --version` =   \r\n"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/334851493","html_url":"https://github.com/angular/angular/issues/12767#issuecomment-334851493","issue_url":"https://api.github.com/repos/angular/angular/issues/12767","id":334851493,"user":{"login":"scaljeri","id":1078741,"avatar_url":"https://avatars3.githubusercontent.com/u/1078741?v=4","gravatar_id":"","url":"https://api.github.com/users/scaljeri","html_url":"https://github.com/scaljeri","followers_url":"https://api.github.com/users/scaljeri/followers","following_url":"https://api.github.com/users/scaljeri/following{/other_user}","gists_url":"https://api.github.com/users/scaljeri/gists{/gist_id}","starred_url":"https://api.github.com/users/scaljeri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scaljeri/subscriptions","organizations_url":"https://api.github.com/users/scaljeri/orgs","repos_url":"https://api.github.com/users/scaljeri/repos","events_url":"https://api.github.com/users/scaljeri/events{/privacy}","received_events_url":"https://api.github.com/users/scaljeri/received_events","type":"User","site_admin":false},"created_at":"2017-10-06T19:42:24Z","updated_at":"2017-10-06T19:42:24Z","author_association":"NONE","body":"This is indeed a very annoying problem. But maybe my decorators can help. If you have\r\n \r\n```typescript\r\nbar$: Observable<Foo>;\r\n...\r\nthis.bar$ = this.route.parent.parent.parent.parent.data.map(d => d['bar'])\r\n```\r\n\r\nit can be written as\r\n```typescript\r\n    @RouteData() bar$: Observable<Foo>;\r\n```\r\n\r\nFor those interested, I have it published to npm [here](https://www.npmjs.com/package/angular-route-xxl). Hope it helps!"}}
{"actor":{"display_login":"scaljeri"}}