Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #20 from eugenehuanggy/overwritten_attributes
Browse files Browse the repository at this point in the history
#19 - Default featureGroup should be assigned gracefully without overwriting existing attributes
nmccready authored Jun 7, 2017
2 parents 3987b69 + 8190f6e commit 4dcedc5
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions dist/ui-leaflet-draw.js
Original file line number Diff line number Diff line change
@@ -107,10 +107,11 @@
}
if (!isDefined(options.edit) || !isDefined(options.edit.featureGroup)) {
_optionsEditedInDirective = true;
angular.extend(options, {
edit: {
featureGroup: new L.FeatureGroup()
}
if (!isDefined(options.edit)) {
options.edit = {};
}
angular.extend(options.edit, {
featureGroup: new L.FeatureGroup()
});
$timeout(function() {
return _optionsEditedInDirective = false;
8 changes: 4 additions & 4 deletions src/drawDirective.coffee
Original file line number Diff line number Diff line change
@@ -59,10 +59,10 @@ angular.module('ui-leaflet')

if !isDefined(options.edit) or !isDefined(options.edit.featureGroup)
_optionsEditedInDirective = true
angular.extend options,
edit:
featureGroup: new L.FeatureGroup()

if !isDefined(options.edit)
options.edit = {}
angular.extend options.edit,
featureGroup: new L.FeatureGroup()
$timeout -> _optionsEditedInDirective = false #skip extra digest due to above mod

_featureGroup = options.edit.featureGroup

0 comments on commit 4dcedc5

Please sign in to comment.