-
-
Notifications
You must be signed in to change notification settings - Fork 40
Description
I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[X] Support request
[ ] Other... Please describe:
Current behavior
On version 9.2.0 components further down the injection tree, that are rendered inside of a template passed to tippy, ([tp]='template') can resolve decencies further up the tree when using the @Host() injection modifier. This was not the case in v9.1.0. In the 9.1 version these components couldn't see things provided further up the tree. We noticed this with ngModels and the Angular Reactive Forms formGroup directive in our production app.
Expected behavior
This issue is to discuss what the expected behavior should be (v9.2.0 or v9.1.0). I am by no means an expert on Angular DI but the behavior in v9.1.0 seems to make more sense to me.
Minimal reproduction of the problem with instructions
I was able to write up a reproduction repo here.
There are two branches bug-exists-on-9-2-1 and bug-not-existant-in-9-1-0 which are based on tags v9.2.0 and v9.1.0
There is an directive appDirectiveProvidingValue that provides 🚀 for the injection token VALUE_PROVIDER. There is a component ComponentUsingValue that injects VALUE_PROIVDER and prints the value to the console.
Steps to reproduce:
- Clone repo and check out
bug-not-existant-in-9-1-0 - Run npm install && npm run start
- Navigate to
/injection-context-seems-off - Click button the page.
- Observe the value printed to the console is
null. - Checkout
bug-exists-on-9-2-1 - Click the button again.
- Observe the value printed to the console is 🚀 instead of null
What is the motivation / use case for changing the behavior?
Environment
Angular version: 17.0.4
Browser:
- [X] Chrome (desktop) version 122.0.6261.129 (Official Build) (arm64) (MacOS)
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: v21.5.0
- Platform: MacOs 14.2.1