javascript - Angularjs, How to destroy partials even using back button from browser? -


i have a,b,c partials in angular. start using page b , , b c. staying @ c, want destroy a, b, c partials (maybe using logout function or similar) if want return using button b or keeping pressing button navigate directly a, how control situation , else? (for example redirect page).

someone knows how it?

thanks in advance.

if have controller each partial can use $destroy, event triggred angular whenever controllers scope destroyed

$destroy()

removes current scope (and of children) parent scope. removal implies calls $digest() no longer propagate current scope , children. removal implies current scope eligible garbage collection.

the $destroy() used directives such ngrepeat managing unrolling of loop.

just before scope destroyed $destroy event broadcasted on scope. application code can register $destroy event handler give chance perform necessary cleanup.

below example on how use it

ctrl.directive('handledestroy', function() {     return function(scope, telement, attributes) {                 scope.$on('$destroy', function() {             alert("in destroy of:" + scope.todo.text);         });     }; }); 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -