Skip to content

Commit ddec45c

Browse files
committed
Element's options attribute is passed to the Map constructor.
1 parent 25ed827 commit ddec45c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/angular-google-maps.js

+11-4
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)