top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

When to use $destroy() function of scope?

+1 vote
365 views
When to use $destroy() function of scope?
posted Oct 27, 2017 by Latha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

$destroy() - This function permanently detached the current scope with all of its children from the parent
scope. This is required when child scopes are no longer needed. Hence, $destroy() function is called to remove
these scopes from the browser’s memory.
When $destroy() is called all the watchers and listeners get removed and the object which represented the scope
becomes eligible for garbage collection.

answer Oct 27, 2017 by Shivaranjini
...