-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Directive can't inject host's ChangeDetectorRef #12816
Comments
Any updates on fixing this bug? This is a UGE issue for me. |
@dfala seems like this is fixed in rc.2 |
@hccampos don't think so http://plnkr.co/edit/Aqjpv3KDrDJbnI43YdzC?p=preview |
@DzmitryShylovich that is right, never mind. Here the use case was a directive to integrate with MobX (https://github.com/mobxjs/mobx-angular) and in that case it is actually acceptable to get the parent's change detector, hence why I thought it had been fixed. |
This also happens when using |
…Ref`. When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes angular#12816
…Ref`. When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes angular#12816
…Ref`. When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes angular#12816
…Ref`. (#16394) When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes #12816
…Ref`. (angular#16394) When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes angular#12816
…Ref`. (angular#16394) When a directive lives on the same element as a component (e.g. `<my-comp myDir>`), the directive was not able to get hold of the `ChangeDetectorRef` of the component on that element. However, as directives are supposed to decorate components, this is incorrect. This commit enables this use case. Closes angular#12816
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
If a directive injects a ChangeDetectorRef it receives the parent element's instance rather than the one on the host element.
I'm not sure if this is intentional, but it seems like there should be a way for the directive to use the host element's ChangeDetectorRef.
Expected behavior
A directive should be able to inject the host element's ChangeDetectorRef
Minimal reproduction of the problem with instructions
I created a directive called RenderOnce that detaches the change detector in ngAfterViewInit.
http://plnkr.co/edit/HKF7etipvdVdl65RaWLG?p=preview
I have two elements that increment a number on an interval, one of them I add the directive, the other one I don't. But the directive detaches the parent component's change detector so they both only render once.
The text was updated successfully, but these errors were encountered: