isteven / angular-multi-select

A multi select dropdown directive for AngularJS. Allows you to use HTML tags and CSS in the data. Requires only AngularJS and nothing else.
isteven.github.io/angular-multi-select
MIT License
1.08k stars 518 forks source link

MouseOver event #525

Closed tandvu closed 7 years ago

tandvu commented 7 years ago

Is there a support for a MouseOver (Hover) an item event? At the moment, when I move the mouse over an item, it got highlighted. I would like to write a function when the item got highlighted.

Thank you.

Tom

isteven commented 7 years ago

@tandvu ,

Unfortunately there's no such mouseover callback. You'll need to modify the directive yourself.

tandvu commented 7 years ago

I'm not good with directive but I would like to give it a try. Would you be able to point me to where I should start?

Thank you so much.

Tom

isteven commented 7 years ago

@tandvu ,

It's just a matter of passing your callback into the directive and then call it during mouseover. For example, you can learn from the directive's on-close callback.

  1. Pass the callback function into the directive Find this in the top of the directive code: onClose: '&',. So for mouseover, you just add something like.. onMouseover: '&' there.

  2. Call it during mouseover There are few ways to do it; one is to modify the template by adding ng-mouseover, or have a event listener in the link function. Both should work.

I highly suggest you to read a bit on AngularJS directive.