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
A projected template is subject to a ChangeDetectionRef which is not controlling the template #14321
Comments
Pinging to see if anyone can verify / label this issue |
sounds reasonable to me. @mhevery what do you think? |
Agree, we should change this. |
Needed for G3 as well! |
… component is dirty checked. Previously a projected view was only dirty checked when the component in which it was inserted was dirty checked. This fix changes the behavior so that a view is also dirty checked if the declaring component is dirty checked. Note: This does not change the order of change detection, only the fact whether a projected view is dirty checked or not. Fixes angular#14321
… component is dirty checked. Previously a projected view was only dirty checked when the component in which it was inserted was dirty checked. This fix changes the behavior so that a view is also dirty checked if the declaring component is dirty checked. Note: This does not change the order of change detection, only the fact whether a projected view is dirty checked or not. Fixes angular#14321
… component is dirty checked. (angular#16592) Previously a projected view was only dirty checked when the component in which it was inserted was dirty checked. This fix changes the behavior so that a view is also dirty checked if the declaring component is dirty checked. Note: This does not change the order of change detection, only the fact whether a projected view is dirty checked or not. Fixes angular#14321
… component is dirty checked. (angular#16592) Previously a projected view was only dirty checked when the component in which it was inserted was dirty checked. This fix changes the behavior so that a view is also dirty checked if the declaring component is dirty checked. Note: This does not change the order of change detection, only the fact whether a projected view is dirty checked or not. Fixes angular#14321
… component is dirty checked. (angular#16592) Previously a projected view was only dirty checked when the component in which it was inserted was dirty checked. This fix changes the behavior so that a view is also dirty checked if the declaring component is dirty checked. Note: This does not change the order of change detection, only the fact whether a projected view is dirty checked or not. Fixes angular#14321
I'm suffering from this in Angular 6. Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: '. Current value: 'ngIf: undefined'. |
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. |
I'm submitting a ... (check one with "x")
Current behavior
When projecting a template into another component as a
ContentChild
, the template is subjected to theChangeDetectorRef
of the host component and not of the component in which the template is defined. This results in a situation in which a projected component is not notified of changes.Expected behavior
A template needs to be independent of the
changeDetectionRef
in which the template is projected, because there is no direct relation between the two components.Minimal reproduction of the problem with instructions
A reproduction of the issue can be found here: https://plnkr.co/edit/tU4EPzvtDSoPBlMuwvRH?p=preview
This plunkr reproduces the problem. A template containing a
ProjectedComponent
is projected into theTestComponent
. All of this is defined in theTestApp
Component. TheProjectedComponent
has an@Input
which can be changed by editing the input element. However, due to theOnPush
changedetection stategy of theTestComponent
, the value is not updated in theProjectedComponent
.It seems that the projected content is subject to the wrong ChangeDetectionStrategy making it impossible to project rich content into another component without (somehow) exposing the changedetection strategy of the host component.
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
Just a browser (JIT)
Angular version: 2.X
Browser: all
Language: Typescript
The text was updated successfully, but these errors were encountered: