-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ng:hover directive is a must #559
Comments
Exposing the event object directly doesn't make sense, it just bleeds the DOM into your controllers (ex. event.target) and mocking event objects is difficult in tests. It might make sense to eventually have a magic $event that exposes only data (non node) properties like pageX/pageY, but that should probably happen separate to ng:hover. ex. ng:click="action($event.pageX, $event.pageY)" |
I forgot about the testing aspect and agree with your suggestion about separating event object from controller. |
Closing as duplication of #314 |
ng-hover please. |
Hopefully it could be easily implemented in few lines of code (CoffeeScript):
angular.directive 'ng:hover', (expression, compiledElement) ->
(linkElement) ->
linkElement.hover (@event) => @$eval(expression)
After that I can use it like this: ng:hover="someAction(event)". It's important to have jQuery event Object in scope to be more crossbrowser.
It could be very nice to see ng:hover in AngularJS core!
The text was updated successfully, but these errors were encountered: