Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
mokesmokes opened this Issue · 9 comments

5 participants

@mokesmokes

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.

@mokesmokes

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
Owner

@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
Owner

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
Owner

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

@mokesmokes

@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:
http://docs.angularjs.org/api/angular.element

@ProLoser
Owner

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

@mokesmokes

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

@ProLoser ProLoser referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@ProLoser ProLoser closed this in d77bfe7
@RanzQ

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) {
    fn.call(element, evt);
  });
}

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

@phillipj

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
Something went wrong with that request. Please try again.