Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

Commit 0663b30

Browse files
committed
fix(paths): Solved a bug on the scope watching of the paths attribute.
Thanks to @lukasz-zak for reporting and point the solution here: tombatossals/angular-leaflet-directive#230
1 parent c380b74 commit 0663b30

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/directives/paths.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ angular.module("leaflet-directive").directive('paths', function ($log, leafletDa
3434
}, true);
3535
};
3636

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

4343
// Listen for changes on the new path
4444
if (isDefined(newPath)) {
45-
leafletPaths[new_name] = newPath;
45+
leafletPaths[newName] = newPath;
4646
map.addLayer(newPath);
47-
watchPathFn(newPath, new_name);
47+
watchPathFn(newPath, newName);
4848
}
4949
}
5050
}

0 commit comments

Comments
 (0)