{"action":"created","issue":{"url":"https://api.github.com/repos/ngParty/ng-metadata/issues/157","repository_url":"https://api.github.com/repos/ngParty/ng-metadata","labels_url":"https://api.github.com/repos/ngParty/ng-metadata/issues/157/labels{/name}","comments_url":"https://api.github.com/repos/ngParty/ng-metadata/issues/157/comments","events_url":"https://api.github.com/repos/ngParty/ng-metadata/issues/157/events","html_url":"https://github.com/ngParty/ng-metadata/issues/157","id":179274634,"number":157,"title":"@ViewChild issue","user":{"login":"hspier","id":6555494,"avatar_url":"https://avatars.githubusercontent.com/u/6555494?v=3","gravatar_id":"","url":"https://api.github.com/users/hspier","html_url":"https://github.com/hspier","followers_url":"https://api.github.com/users/hspier/followers","following_url":"https://api.github.com/users/hspier/following{/other_user}","gists_url":"https://api.github.com/users/hspier/gists{/gist_id}","starred_url":"https://api.github.com/users/hspier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hspier/subscriptions","organizations_url":"https://api.github.com/users/hspier/orgs","repos_url":"https://api.github.com/users/hspier/repos","events_url":"https://api.github.com/users/hspier/events{/privacy}","received_events_url":"https://api.github.com/users/hspier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-26T16:24:04Z","updated_at":"2016-09-27T08:04:18Z","closed_at":null,"body":"When using @ViewChild with a component class, I end up with an undefined variable because the child component controller is never set during view initialization, but it is set right after.\r\n\r\nUsing the selector string instead returns me a valid jqLite instance but if I try to fetch the controller in ngAfterViewInit or ngAfterViewChecked, the controller is not set.\r\n\r\nI am not using ng-if, ng-repeat directives that could delay the execution, but I am using templateUrl for all of my components (but they are already precached in the $templateCache) if this could be a problem. However, I did try switching to standard template and it didn't fix the issue.\r\n\r\nIn my application, the child component doesn't know about the parent and sits in a separate module and only the parent retrieves an instance the child component. I don't need the forwardRef in this case.\r\n\r\nWorkaround is to put a 0 $timeout that finishes initialization, but I would like to avoid having to resort to this.\r\n\r\nAny ideas ? \r\n\r\nI am using ng-metadata 2.1.1.\r\n"},"comment":{"url":"https://api.github.com/repos/ngParty/ng-metadata/issues/comments/249794555","html_url":"https://github.com/ngParty/ng-metadata/issues/157#issuecomment-249794555","issue_url":"https://api.github.com/repos/ngParty/ng-metadata/issues/157","id":249794555,"user":{"login":"Hotell","id":1223799,"avatar_url":"https://avatars.githubusercontent.com/u/1223799?v=3","gravatar_id":"","url":"https://api.github.com/users/Hotell","html_url":"https://github.com/Hotell","followers_url":"https://api.github.com/users/Hotell/followers","following_url":"https://api.github.com/users/Hotell/following{/other_user}","gists_url":"https://api.github.com/users/Hotell/gists{/gist_id}","starred_url":"https://api.github.com/users/Hotell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hotell/subscriptions","organizations_url":"https://api.github.com/users/Hotell/orgs","repos_url":"https://api.github.com/users/Hotell/repos","events_url":"https://api.github.com/users/Hotell/events{/privacy}","received_events_url":"https://api.github.com/users/Hotell/received_events","type":"User","site_admin":false},"created_at":"2016-09-27T08:04:18Z","updated_at":"2016-09-27T08:04:18Z","body":"can you provide a plunk pls? https://plnkr.co/edit/7Fr7oO\r\n\r\n**note about templateUrl:**\r\n\r\n- using it can become PITA, because even when you provide the template in `$templateCache` it loads it async in next tick, so I highly recommend to always use `template`"}}
{"actor":{"display_login":"Hotell"}}