Closed naveedahmed1 closed 7 months ago
Hi, could you provide a stackblitz reproduction of this issue ?
The error you are reporting indicates that elementRef.nativeElement
exists but doesn't have a style property.
Ok, I have a repro: https://stackblitz.com/edit/angular-issue-54798?file=package.json,src%2Fmain.ts&template=node
The directive is constructed twice when the selector is a class. The first time the element ref is a comment node. It only happens when it's wrapped by an @if
block.
Thank you @JeanMeche for looking into this. But since the if condition
is false, it shouldn't be constructed at all, right?
It was working fine in v17.2.0
.
You're absolutely right, there is a regression a play here.
I removed everything from my app component and left the exact same code that I have mentioned above and its still throwing error.
I also tried printing the values of both variables in if conditions:
isBrowser: true showInstallButton: false
So button indeed doesnt exist in dom. Therefore the directive shouldn't execute.
Thanks for testing the RC ❤️ I believe this is the first template pipeline bug found "in the wild" - congrats!
More discussion in #54800 -- Joost has fixed this in the runtime, but I'm wondering whether we should also change Template Pipeline to match the TDB const array.
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.
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
I just updated my app from Angular Version 17.2.0 to Version 17.3.0-rc.0 and noticed this strange behaviour
Here's my app component:
App Component HTML:
And a Ripple Directive:
My assumption is the directive code sholdn't execute in this case since the value of showInstallButton is false.
But it seems that its still executing the directive code and throwing below error:
The error points to these lines in directive:
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version
)Anything else?
No response