Including just the Google Maps directive doesn't work #390

mokesmokes opened this Issue Jan 30, 2013 · 9 comments


None yet
5 participants

Per the instructions, I included common/module.js and the maps.js directive, and this setup doesn't pass events to the DOM (e.g. clicking on the map doesn't create markers). When I included angular-ui.js instead of module.js and maps.js - everything works as expected. That was the only change. Please provide better guidance in the docs how to add specific directives instead of the full angular-ui package.

And is it absolutely required to use jQuery's trigger() inside map.js, instead of the Angular built-in triggerHandler()? Would be nice to eliminate dependencies upon jQuery wherever possible.


ProLoser commented Jan 31, 2013

@ajoslin what more needs to be done? Does map have a dependency on uiEvent or jQuery? @mokesmokes did you also include jQuery? or are you JUST using angular?


ajoslin commented Feb 1, 2013

Oh cool, didn't know about angular's trigger. Is angular's internal trigger available to use outside angular core?

If so we should switch to it so map only needs uiEvent.


ProLoser commented Feb 1, 2013

I don't get why angular would use a different api for triggering events... I think you might want to double-check the suggestion.

@ProLoser - I tried to use just angular but then trigger() is undefined, and it's used in map.js. So at the moment jQuery is required for your Google Maps implementation. However, triggerHandler is available OOTB in angular, so why not use just that? Here is the full list of jQuery APIs available directly from angular:


ProLoser commented Feb 1, 2013

@mokesmokes mind helping us out with a PR then? I don't think it will need a unit test.

I'll take a look at it in a few days, no problem.

@ProLoser ProLoser closed this in d77bfe7 Feb 9, 2013

RanzQ commented Apr 2, 2013

I struggled with this a couple of hours until I realized jqLite's triggerHandler doesn't work like jQuery's. My event handlers in the controller didn't get fired until I included jQuery. I ended up forking jqLite like this:

triggerHandler: function(element, evt) {
  var eventName = evt.type ? evt.type : evt;
  var eventFns = (JQLiteExpandoStore(element, 'events') || {})[eventName];

  forEach(eventFns, function(fn) {, evt);

So now jqLite can also pass events the same way (I guess there's a reason for jqLite not passing events though).

Just spent a couple of hours myself debugging an triggerHandler issue. Currently (Angular 1.0.7) data sent along when triggering events will not be delivered to event listeners - although it will if jQuery is included.

Happily a fix was just commited into Angular with angular/angular.js@0cac872

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment