You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This is basically, a reversible $destroy for scopes.
Detaching the scope would mean:
Detaching the scope from the scope's current parent so that watchers no longer fire when the scope's current parent's $digest is called
On re-attaching to a DOM element (as a child), it would be attached as the child scope of the DOM element
I could see this being used for optimizations such as not running watchers on hidden DOM (that could be detached).
I think a factor that affects the adoption of Angular is the fact that having many watchers could slow down the application. Currently, there's no way to "pause" the watchers on DOM that's not currently visible.
It's possible to hack out a directive to do this, but I'm wondering if this feature is of value to the rest of the Angular community as part of the Angular core.
I noticed that jqLite doesn't have .detach. .remove actually destroys the scope of the element so after re-adding it to the DOM, it actually picks up the another scope and has already lost its own scope.