-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
ObjectUnsubscribedError when md-slider removed and re-added via *ngIf #6892
Comments
Seems like your plunker is outdated (specifically |
Im getting the same error on snackbar components on latest pull |
devversion
added a commit
to devversion/material2
that referenced
this issue
Sep 7, 2017
If a slider component will be destroyed, the `ngOnDestroy` hook calls `_directionality.change.unsubscribe()`, which means that the `unsubscribe` method is called on the `EventEmitter` instead of the actual `Subscription`. This causes the `EventEmitter` to be kind of "completed", which then means that there will be errors if `emit()` is called again (https://github.com/ReactiveX/rxjs/blob/master/src/Subject.ts#L96). Also fixes that the drawer never unsubscribes from the `_dir.change` `EventEmitter`. This means that even if the component is destroyed, whenever the directionality changes, the drawer calls `validateDrawers()`. Fixes angular#6892. Fixes angular#6903.
devversion
added a commit
to devversion/material2
that referenced
this issue
Sep 7, 2017
If a slider component will be destroyed, the `ngOnDestroy` hook calls `_directionality.change.unsubscribe()`, which means that the `unsubscribe` method is called on the `EventEmitter` instead of the actual `Subscription`. This causes the `EventEmitter` to be kind of "completed", which then means that there will be errors if `emit()` is called again (https://github.com/ReactiveX/rxjs/blob/master/src/Subject.ts#L96). Also fixes that the drawer never unsubscribes from the `_dir.change` `EventEmitter`. This means that even if the component is destroyed, whenever the directionality changes, the drawer calls `validateDrawers()`. Fixes angular#6892. Fixes angular#6903.
tinayuangao
pushed a commit
that referenced
this issue
Sep 8, 2017
) If a slider component will be destroyed, the `ngOnDestroy` hook calls `_directionality.change.unsubscribe()`, which means that the `unsubscribe` method is called on the `EventEmitter` instead of the actual `Subscription`. This causes the `EventEmitter` to be kind of "completed", which then means that there will be errors if `emit()` is called again (https://github.com/ReactiveX/rxjs/blob/master/src/Subject.ts#L96). Also fixes that the drawer never unsubscribes from the `_dir.change` `EventEmitter`. This means that even if the component is destroyed, whenever the directionality changes, the drawer calls `validateDrawers()`. Fixes #6892. Fixes #6903.
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug, feature request, or proposal:
Bug
What is the expected behavior?
The slider can be removed and added to the page by toggling the condition of an
*ngIf
directive on the slider itself or on a parent element/component.What is the current behavior?
After removing the slider, and then adding it again by toggling the *ngIf off and on, an
ObjectUnsubscribedError
is raised.What are the steps to reproduce?
https://embed.plnkr.co/oqhT6YMKMMKDopXfxgM7/
What is the use-case or motivation for changing an existing behavior?
The current behavior breaks the page if an
md-slider
is inside an*ngIf
.Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Tested in Angular 4.4.0-RC.0, Material 2.0.0-beta.10-6b5100b, Chrome 60, TypeScript 2.1.6
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: