Skip to content

Commit 9ae3276

Browse files
committed
Merge pull request angular-ui#20 from TheBestDay/options
Merged. Will have to do additional work to make sure that options do not overwrite the center and zoom which comes from the parent scope. Some refactoring will be needed.
2 parents 25ed827 + ddec45c commit 9ae3276

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/angular-google-maps.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
this.dragging = false;
7777
this.selector = o.container;
7878
this.markers = [];
79+
this.options = o.options;
7980

8081
this.draw = function () {
8182

@@ -88,12 +89,12 @@
8889

8990
// Create a new map instance
9091

91-
_instance = new google.maps.Map(that.selector, {
92+
_instance = new google.maps.Map(that.selector, angular.extend(that.options, {
9293
center: that.center,
9394
zoom: that.zoom,
9495
draggable: that.draggable,
9596
mapTypeId : google.maps.MapTypeId.ROADMAP
96-
});
97+
}));
9798

9899
google.maps.event.addListener(_instance, "dragstart",
99100

@@ -357,14 +358,20 @@
357358
}
358359

359360
angular.element(element).addClass("angular-google-map");
361+
362+
// Parse options
363+
var opts = {options: {}};
364+
if (attrs.options) {
365+
opts.options = angular.fromJson(attrs.options);
366+
}
360367

361368
// Create our model
362-
var _m = new MapModel({
369+
var _m = new MapModel(angular.extend(opts, {
363370
container: element[0],
364371
center: new google.maps.LatLng(scope.center.lat, scope.center.lng),
365372
draggable: attrs.draggable == "true",
366373
zoom: scope.zoom
367-
});
374+
}));
368375

369376
_m.on("drag", function () {
370377

0 commit comments

Comments
 (0)