jquery - Do we need to unbind event listeners in directives when angular starts to destroy? -


there heavy memory leak in application haven't found out causes, , here background.

  • i using angularjs + jquery(plugins)
  • many listeners bound following:

    $(element).on("keyup", function() {});

so question is

do need unbind listeners in directives following?

scope.$on("$destroy", function() {     $(element).off(); });  

btw, how find out memory leak in web application? use chrome's profile (see here profiling memory performance) not trace codes memory leaks. have suggestions?

thanks lot!

the angular documentation scope destroy, implies need remove dom events.

http://docs.angularjs.org/api/ng.$rootscope.scope#$destroy

note that, in angularjs, there $destroy jquery event, can used clean dom bindings before element removed dom.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -