Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queries field for @Component and @Directive #186

Open
sliultron opened this issue Dec 9, 2016 · 2 comments
Open

queries field for @Component and @Directive #186

sliultron opened this issue Dec 9, 2016 · 2 comments

Comments

@sliultron
Copy link

Can anyone please help and provide some example of using queries field?
I try to use ViewChild to get the myChildComponent reference within the rootComponent class. However, it always returns undefined in ngAfterViewInit and ngAfterViewChecked







on the documentation, it says better to use queries field. However, there is no further example for that.
Any help is appreciated.
Thanks

@Hotell
Copy link
Member

Hotell commented Dec 24, 2016

Hey! can you provide a Plnkr pls or some code example? thanks!

@Hotell
Copy link
Member

Hotell commented Dec 24, 2016

also using queries is not recommended if you wanna query anything within dynamic scope ( content within ngIf or ngRepeat etc ), because those things are not guaranteed to be present, so it will return undefined most of the time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants