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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: IVY ViewChild does not work when defined in base class #33292

Closed
kukjevov opened this issue Oct 21, 2019 · 7 comments
Closed

BUG: IVY ViewChild does not work when defined in base class #33292

kukjevov opened this issue Oct 21, 2019 · 7 comments
Labels
area: core Issues related to the framework runtime
Milestone

Comments

@kukjevov
Copy link
Contributor

馃悶 bug report

Affected Package

@angular/core

Is this a regression?

Definitely yes, it is working without IVY.

Description

When you define ViewChild (probably same with ViewChildren, maybe even with ContentChild) in parent base class, this property will never be set by Angular.

馃敩 Minimal Reproduction

git clone https://github.com/kukjevov/ng-universal-demo.git
cd ng-universal-demo
git checkout ivy-error
npm install
npm start
open browser on http://localhost:8888/garden
you should see undefined in console instead of requested instance of component

馃敟 Exception or Error

No error just missing value of property with ViewChild

馃實 Your Environment

Angular Version:
Angular 9-next.12

Anything else relevant?
Windows: 10.0.17763
Node: 11.6.0
NPM: 6.9.0

@dannyskoog
Copy link
Contributor

Do you have decorator (e.g. @Directive()) on the base class?

@kukjevov
Copy link
Contributor Author

kukjevov commented Oct 21, 2019

@alexzuza
Copy link
Contributor

alexzuza commented Oct 21, 2019

Related thread #30080 (comment)

@dannyskoog
Copy link
Contributor

@kukjevov the reason why I brought up @Directive is due to this https://next.angular.io/guide/migration-undecorated-classes

@AndrewKushnir AndrewKushnir added area: core Issues related to the framework runtime comp: ivy labels Oct 22, 2019
@ngbot ngbot bot modified the milestone: needsTriage Oct 22, 2019
@kukjevov
Copy link
Contributor Author

Oh thx @dannyskoog i tried it and it is working :). But still if it is final state, this is breaking change that should be mentioned, but as workaround it is working :).

@alxhub
Copy link
Member

alxhub commented Oct 29, 2019

@kukjevov glad to hear it's working for you. There are a set of code migrations for Ivy which are required - you can see that in the next.angular.io link posted above. The CLI applies these migrations automatically when updating to v9.

@alxhub alxhub closed this as completed Oct 29, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime
Projects
None yet
Development

No branches or pull requests

5 participants