{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/8825","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/8825/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/8825/comments","events_url":"https://api.github.com/repos/angular/angular/issues/8825/events","html_url":"https://github.com/angular/angular/issues/8825","id":156639112,"number":8825,"title":"Parent variable not working inside of ng-content","user":{"login":"sjova","id":2111828,"avatar_url":"https://avatars.githubusercontent.com/u/2111828?v=3","gravatar_id":"","url":"https://api.github.com/users/sjova","html_url":"https://github.com/sjova","followers_url":"https://api.github.com/users/sjova/followers","following_url":"https://api.github.com/users/sjova/following{/other_user}","gists_url":"https://api.github.com/users/sjova/gists{/gist_id}","starred_url":"https://api.github.com/users/sjova/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjova/subscriptions","organizations_url":"https://api.github.com/users/sjova/orgs","repos_url":"https://api.github.com/users/sjova/repos","events_url":"https://api.github.com/users/sjova/events{/privacy}","received_events_url":"https://api.github.com/users/sjova/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-25T00:33:30Z","updated_at":"2016-05-25T13:10:02Z","closed_at":"2016-05-25T13:10:02Z","body":"**Intro:** I'm working on ng2 components whose structure looks like this:\r\n\r\n    <cards>\r\n      <card>\r\n      \t<card-content-type-1></card-content-type-1>\r\n      </card>\r\n      <card>\r\n      \t<card-content-type-2></card-content-type-2>\r\n      </card>\r\n      <card>\r\n      \t<card-content-type-3></card-content-type-3>\r\n      </card>\r\n      ...\r\n    </cards>\r\n\r\nI'm changing states of each `<card>` based on click/mouseenter/mouseleave events, and when some action happen inside of `<card>` component (parent component), based on current state, I'd like to trigger some animation methods inside `<card-content-type-N>` components (children component). For animations I'll use `AnimationBuilder` and `ElementRef`.\r\n\r\n\r\n----------\r\n\r\n\r\n**Issue:** I decided to pass parent component variable to children component, and to implement `ngOnChanges()` inside of children, which will trigger specific animation depends of current variable value. But I have troubles to pass parent variable to children when I use ng-content inside of parent template.\r\n\r\nI created simplified example (only parent and children components): https://plnkr.co/edit/OHIJjMwdx6ifRiSxsanB?p=preview\r\n\r\nIn this example `parentVar` is not passed into the `child-comp`. Is this some bug in Angular2 or I'm doing something wrong? I suppose that is related with `ng-content` scope, but we lack good docs/examples about this (or at least, I missed docs about `ng-content`)\r\n\r\nIn same example inside of `src/parent-comp.ts` if we replace intial template with `<child-comp [childVar]=\"parentVar\"></child-comp>` parent variable is passed properly.\r\n\r\nAlso inside of `src/app.ts` if we replace initial template with  this:\r\n\r\n    <parent-comp>\r\n      <child-comp [childVar]=\"true\"></child-comp>\r\n    </parent-comp>\r\n\r\nstatic variable is passed properly.\r\n\r\nDoes someone have a similar issue? Or have idea how I can solve this issue? Thanks.\r\n\r\n* **Angular version:** 2.0.0-beta.17 \r\n* **Browser:** all\r\n* **Language:** TypeScript 1.7.3"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/221570780","html_url":"https://github.com/angular/angular/issues/8825#issuecomment-221570780","issue_url":"https://api.github.com/repos/angular/angular/issues/8825","id":221570780,"user":{"login":"jeffbcross","id":463703,"avatar_url":"https://avatars.githubusercontent.com/u/463703?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffbcross","html_url":"https://github.com/jeffbcross","followers_url":"https://api.github.com/users/jeffbcross/followers","following_url":"https://api.github.com/users/jeffbcross/following{/other_user}","gists_url":"https://api.github.com/users/jeffbcross/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffbcross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffbcross/subscriptions","organizations_url":"https://api.github.com/users/jeffbcross/orgs","repos_url":"https://api.github.com/users/jeffbcross/repos","events_url":"https://api.github.com/users/jeffbcross/events{/privacy}","received_events_url":"https://api.github.com/users/jeffbcross/received_events","type":"User","site_admin":false},"created_at":"2016-05-25T13:10:02Z","updated_at":"2016-05-25T13:10:02Z","body":"The plunker appears to work correctly if I uncomment `public parentVar: boolean = false;` in app.ts. If you're still experiencing this issue, can you update the plunker to work against rc.1 and open a new issue?"}}
{"actor":{"display_login":"jeffbcross"}}