javascript - AngularJS: Event callback doesn't fire on google maps native map marker -
i've forked angularui's uimap directive in order swap infowindow infobox , add markerclusters. i've made extensive updates uimap -> icmap; notably moved directive logic out of controllers, making uimap "master" directive). i've got working, except clicking native mapmarker doesn't open infobox.
i think reason i'm not binding click event native mapmarker (ic-map.js:163).
before re-organised uimap had added icmapinfobox directive in map.js. open event registered/triggered by:
ui-event="{'map-click':'openmarkerinfo(marker)'}" which called openmarkerinfo() defined in controller (copy/paste repo: github gist).
however, when click native mapmarker, nothing happens , no errors in console (but other events still fire properly).
original plunk
simplified plunk (removed markerclusters)
in both plunks, problem lies in ic-map.js (first file in list)
map.json data file
angular.js, angular-ui.js, , infobox.js lib files
edit noticed infobox.map undefined; i'm guessing has problem.
edit undefined infobox.map property part of problem: manual call infobox.open on ic-map.js:189 works (template isn't being compiled, that's different problem), click event still doesn't trigger infobox.open. template not getting included.
solved: had been treating marker dom object instead of js object. post solution soon.
working example: http://plnkr.co/edit/mamx5exthxso4aqmszud
- original > ic-map.js:156 event listener should have been bound
google.maps.event.addlistener()(see working example > ic-map.js:154-156). - also, trouble use templates, added 2 divs children of
div#map(see working example > index.html:41-42). due how inheritence , shared models work, of directives must on same dom element (because no-one can down, up). necessary moving directive logic out of controller (as implementation angularui). in implementation, model shared across icmaps* directives within directives (and directive controllers). - difference of
marker:- uimapmarker,
markerattached dom object:ng-repeat="marker in markers" - icmapmarkers,
markerjs object.
- uimapmarker,
Comments
Post a Comment