Skip to content

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

@concertcoder

Description

@concertcoder

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions