Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Memory leak in directives for some use cases #37

Open
stianlik opened this issue Feb 10, 2014 · 0 comments
Open

Memory leak in directives for some use cases #37

stianlik opened this issue Feb 10, 2014 · 0 comments

Comments

@stianlik
Copy link

The bindMapEvents()-function attaches events to google-maps objects, but it does not handle unbinding when objects are removed (or replaced).

The following use case will cause a memory leak each time setProject() is called.

var markers = {
    "firtProject": [/* list of  Google Maps markers */],
    "secondProject": [/* list of Google Maps markers */]
};
$scope.setProject = function(project) {
    $scope.markers = markers[project];
};
$scope.markerClicked = function(marker) {
    /* some action */
};
<button ng-click="setProject('firstProject')">Project 1</button>
<button ng-click="setProject('secondProject')">Project 2</button>
<div ng-repeat="marker in markers" ui-map-marker="markers[$index]" ui-event="{'map-click': 'markerClicked(marker)'}"></div>

Directive should store unbind markers when they are removed from scope.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant