-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Calling field initializers (input, output, queries, etc) should be errors when not used to declare a field in a directive #54381
Comments
|
This is not supported. Angular requires that inputs/outputs/queries/etc are declared and initialized as class members. |
|
As @JoostK pointed out, only field initializers are supported. Having said this, we should inform users of this misuse (a lint check, compiler error or some other mechanism). |
…of an initializer Adds a rule that will produce a diagnostic when an initializer-based API is used outside of an initializer. Fixes angular#54381.
…of an initializer Adds a rule that will produce a diagnostic when an initializer-based API is used outside of an initializer. Fixes angular#54381.
…of an initializer Adds a rule that will produce a diagnostic when an initializer-based API is used outside of an initializer. Fixes angular#54381.
…of an initializer (angular#54993) Adds a rule that will produce a diagnostic when an initializer-based API is used outside of an initializer. Fixes angular#54381. PR Close angular#54993
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
Yes
Description
Assign viewChildren() to a variable instead of a property.
run ngc
yarn run ngc -p tsconfig.jsonoutput
the compile no generate viewQuery: function AppComponent_Query(rf, ctx) code.
I try another way also same
Not really sure if it's a bug or by design. Does the code style have to follow the required format for compilation?
Please provide a link to a minimal reproduction of the bug
https://github.com/keatkeat87/Angular-viewChildren-not-be-compile-when-assign-to-variable
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
No response
The text was updated successfully, but these errors were encountered: