rajeshwarpatlolla / ionic-datepicker

'ionic-datepicker' bower component for ionic framework applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory Leak - Forgot to remove the modal attached to scope from ionicModal.fromTemplateUrl

concertcoder opened this issue · comments

Hey,

I was going through my project fixing up any memory leaks and I found one in your project.

$ionicModal.fromTemplateUrl('ionic-datepicker-modal.html', {
scope: scope,
animation: 'slide-in-up'
}).then(function (modal) {
scope.modal = modal;
});

The modal attached to scope needs to be cleaned up when the scope is destroyed.

scope.$on('$destroy', function() {
scope.modal.remove();
});

Just put this below that piece of code and it'll fix the memory leak.

Thanks for pointing it out @concertcoder

@rajeshwarpatlolla No problem, thanks for the code ;)

Please check the new release v1.0.0. This issue has been addressed.