Memory leak in official AngularJS UT Bootstrap $ modal example?

I am trying to figure out how to avoid memory leaks in AngularJS. It seems that there is almost no documentation on what needs to be cleaned, which, as one would expect, if garbage collection was perfect and all-knowing. However, my reading indicates that it is easy to leave the associated DOM elements that prevent garbage collection, this https://stackoverflow.com/a/165998/118 says that we must manually unlock any bindings set in the directives and to a smaller scale, clear also $ timeouts . I came across this article , which asks me to look for "individual DOM elements".

Using only a sample $ modal code from the AngularJS UML site , I found numerous significant individual elements after opening and closing the modal dialog. It does not seem to grow with a second click, but if I have a lot of dialogs, each of them leaves its mark on the form forever. I tried to install modalInstance = nullafter closing, but did nothing.

Are the items taken really bad? If so, how should the modular UML code for AngularJS be modified to resolve these errors?

More importantly, are there simple, understandable instructions for what exactly needs to be cleared when using AngularJS? It's nice that they provide the $ on function. $ Destroy, but I can’t find any clear instructions indicating what I am responsible for cleaning up or how to do it.

+4
source share
2 answers

, - , . . , ui.bootstrap modal $modal factory, . , .

github: https://github.com/dhilt/angular-bootstrap-modal-singleton. , .

0

angular -ui:

, . , ,

fix

0

All Articles