Skip to content

Commit

Permalink
fix(paths): Solved a bug on the scope watching of the paths attribute.
Browse files Browse the repository at this point in the history
Thanks to @lukasz-zak for reporting and point the solution here:
#230
  • Loading branch information
tombatossals committed Jan 9, 2014
1 parent c380b74 commit 0663b30
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/directives/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ angular.module("leaflet-directive").directive('paths', function ($log, leafletDa
}, true);
};

scope.$watch("paths", function (newPaths) {
leafletScope.$watch("paths", function (newPaths) {
// Create the new paths
for (var new_name in newPaths) {
if (!isDefined(leafletPaths[new_name])) {
var newPath = createPath(new_name, newPaths[new_name], defaults);
for (var newName in newPaths) {
if (!isDefined(leafletPaths[newName])) {
var newPath = createPath(newName, newPaths[newName], defaults);

// Listen for changes on the new path
if (isDefined(newPath)) {
leafletPaths[new_name] = newPath;
leafletPaths[newName] = newPath;
map.addLayer(newPath);
watchPathFn(newPath, new_name);
watchPathFn(newPath, newName);
}
}
}
Expand Down

0 comments on commit 0663b30

Please sign in to comment.