Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

support all browser events out of the box (ng:hover) #314

Closed
mhevery opened this issue Mar 26, 2011 · 7 comments
Closed

support all browser events out of the box (ng:hover) #314

mhevery opened this issue Mar 26, 2011 · 7 comments
Labels
Milestone

Comments

@mhevery
Copy link
Contributor

mhevery commented Mar 26, 2011

we should support all browser events (mouseover, etc) out of the box.

@ghost ghost assigned mhevery Jun 20, 2011
@vojtajina
Copy link
Contributor

I think we want to support these events:

  • dblclick (ng:dbl-click)
  • mouseenter (ng:mouse-enter)
  • mouseleave (ng:mouse-leave)

All of these (along with current ng:click) are just "wrappers" for events (just $apply the expression and ???stopPropagation of the event), so we want a generic function to create these widgets (as they are all the same).

See current ng:click implementation for inspiration. (and refactor ng:click to use the same approach).

Note, I listed mouseenter instead of mouseover (and mouseleave instead of mouseout), as I think that's more useful behavior.
This means, these directives will work only when using jQ (or we have to implement them in jqLite), but I think it's still worthy.

See jQuery:
http://api.jquery.com/mouseenter/
http://api.jquery.com/mouseleave/
http://api.jquery.com/hover/

@gruber76
Copy link

Hey, it looks like the current git code has started breaking these out, making them each separate directives. Why not have a single directive? Really roughly:

angularDirective("ng:bindEvent", function(expression, element){
return function(element){
var self = this, exp=expression.split(':');
element.bind(exp[0], function(event){
self.$apply(exp[1]);
event.stopPropagation();
});
};
});

Gives you


(I'd have put together a preliminary pull request to spark conversation if there weren't already code that appears to address this. Still figuring gihub's issue system out.)

@vojtajina
Copy link
Contributor

@gruber76 Problem with this general solution is bringing new syntax - using semi colon (or any other special character) for splitting the event from expression, so I would definitely prefer multiple directives, it does not hurt and the resulting api is IMHO nicer.

Btw, the only missing directive is "hover" - other directives are already implemented.
Adding hover is only about adding hover to jqLite.

@IgorMinar
Copy link
Contributor

we don't have hover, but we do have mouse enter, mouse leave and mouse over. so I think that we covered everything.

@gops
Copy link

gops commented Aug 19, 2012

this issue is closed. does this means we have blur and focus events ?

@mhevery
Copy link
Contributor Author

mhevery commented Aug 19, 2012

we now support click dblclick mousedown mouseup mouseover mouseout
mousemove mouseenter mouseleave

looks like we forgot blur and focus.

can you add a separate bug?

On Sun, Aug 19, 2012 at 3:03 AM, Gopal Patel notifications@github.comwrote:

this issue is closed. does this means we have blur and focus events ?


Reply to this email directly or view it on GitHubhttps://github.com//issues/314#issuecomment-7851955.

@lanterndev
Copy link
Contributor

quoting @mhevery:

looks like we forgot blur and focus. can you add a separate bug?

looks like that's #1277.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants