2

i have a <select> tag and use ng-options to bind options of select. my question is how to add ng-dbclick to each option of select

here is my code

<select  size="4"  ng-model="pattern" ng-options="p.name  for p in patterns | filter:obj">

</select>
4

1 回答 1

6

I don't think that you can add an event handler to an option of a select box in js so this won't work in angular either.

What you can do is add the ng-dblclick to the select element and then get the selected option which will also be the doubleclicked one.

This would be the value of your pattern model.

<select  size="4"  ng-model="pattern" ng-dblclick="doYourStuff()" ng-options="p.name  for p in patterns | filter:obj">

</select>

Have a look at this plunker for a demo.

于 2013-08-03T15:08:51.800 回答