0

I would like to invoke a function when target element has been deleted. I tried something like below, and it seems like working well. Is it okay to use this code? (since there is no reference document about 'remove' listener on neither angularjs nor jquery)

angular.element( event.currentTarget)
     .on( 'remove', function() {
         // some code
     })

2 Answers 2

1

The AngularJS framework intercepts jQuery .remove operations and dispatches a $destroy event.

From the Docs:

Events

$destroy - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event on all DOM nodes being removed. This can be used to clean up any 3rd party bindings to the DOM element before it is removed.

For more information, see

Sign up to request clarification or add additional context in comments.

Comments

0

You can find related doc on AngularJS page https://docs.angularjs.org/api/ng/function/angular.element, also on JQuery's API page https://api.jquery.com/remove/

How about this? https://api.jquery.com/on/#event-names

1 Comment

Thanks but I'm not looking for deleting element method. need a document that refer 'on remove listener' when an element has been deleted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.