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

Adding support for InfoBubble: a more customizable infowindow. #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/ui-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,43 @@
};
}]);

/*
* Support for Infobubble [http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/]
* "A InfoBubble is a customizable css3 infowindow."
* Fully customizable with support for tabs
*/
app.directive('uiMapInfoBubble',
['ui.config', '$parse', '$compile', function (uiConfig, $parse, $compile) {

var infoBubbleEvents = 'closeclick content_change domready ' +
'position_changed zindex_changed';
var options = uiConfig.mapInfoBubble || {};
window.infoBubbleOptions = options;
return {
link: function (scope, elm, attrs) {
var opts = angular.extend({}, options, scope.$eval(attrs.uiOptions));
opts.content = elm[0];
var model = $parse(attrs.uiMapInfoBubble);
var infoBubble = model(scope);

window.infoBubbleOptions = opts;
if (!infoBubble) {
infoBubble = new InfoBubble(opts);
model.assign(scope, infoBubble);
}

bindMapEvents(scope, infoBubbleEvents, infoBubble, elm);

//Decorate infoWindow.open to $compile contents before opening
var _open = infoBubble.open;
infoBubble.open = function open(a1, a2, a3, a4, a5, a6) {
//$compile(elm.contents())(scope);
_open.call(infoBubble, a1, a2, a3, a4, a5, a6);
};
}
};
}]);

/*
* Map overlay directives all work the same. Take map marker for example
* <ui-map-marker="myMarker"> will $watch 'myMarker' and each time it changes,
Expand Down