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

Template and host context gets confused #12004

Closed
pkozlowski-opensource opened this issue Sep 30, 2016 · 2 comments
Closed

Template and host context gets confused #12004

pkozlowski-opensource opened this issue Sep 30, 2016 · 2 comments
Labels
area: core Issues related to the framework runtime freq1: low type: bug/fix

Comments

@pkozlowski-opensource
Copy link
Member

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting

Current behavior

When a directive:

  • is used within the ngFor block
  • has a host binding with an non-constant expression
  • expression in the host uses a field with the same name as a variable declared in the ngFor block

then the directives field is "shadowed" by a variable declared in the ngFor block.

Expected behavior

Host bindings are evaluated against an appropriate context regardless if the directive is used inside ngFor block or not.

Reproduction of the problem

https://plnkr.co/edit/AgysQsIPMd81W37ON5Ux?p=preview

Expected behavior: foo, bar and baz are rendered with the red background
Current behavior: foo, bar and baz are rendered without any background

  • Angular version: 2.0.1
  • Browser: all
  • Language: all
@pkozlowski-opensource
Copy link
Member Author

Just for the record - I'm not trying to find contrived cases here - this is happening in real projects and was originally reported in ng-bootstrap/ng-bootstrap#813

pkozlowski-opensource added a commit to pkozlowski-opensource/angular that referenced this issue Oct 4, 2016
pkozlowski-opensource added a commit to pkozlowski-opensource/angular that referenced this issue Oct 6, 2016
tbosch added a commit to tbosch/angular that referenced this issue Oct 19, 2016
tbosch added a commit to tbosch/angular that referenced this issue Oct 19, 2016
tbosch added a commit to tbosch/angular that referenced this issue Oct 19, 2016
tbosch added a commit to tbosch/angular that referenced this issue Oct 19, 2016
tbosch added a commit to tbosch/angular that referenced this issue Oct 20, 2016
tbosch added a commit to tbosch/angular that referenced this issue Oct 20, 2016
@alxhub alxhub closed this as completed in 867494a Oct 20, 2016
btrigueiro pushed a commit to btrigueiro/angular that referenced this issue Oct 21, 2016
@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 Sep 10, 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 freq1: low type: bug/fix
Projects
None yet
2 participants