<select id="from" multiple="multiple" name="list" ng-model="selectedVal">
<optgroup label= "{{geo.Geo}}" ng-repeat="geo in Geographies">
<option id="{{country.CountryKey}}" ng-repeat="country in geo.Country" ng-click="arrayPush()">{{country.CountryDescription}}</option>
</optgroup>
</select>
单击特定选项时,未调用arrayPush()
$scope.arrayPush = function(){alert("Hello!");}
答案 0 :(得分:1)
我刚刚找到了我的问题的答案
<select id="from" multiple="multiple" name="list" ng-model="selectedVal" ng-change="arrayPush()">
<optgroup label= "{{geo.Geo}}" ng-repeat="geo in Geographies">
<option id="{{country.CountryKey}}" ng-repeat="country in geo.Country" >{{country.CountryDescription}}</option>
</optgroup>
</select>
不使用ng-click in选项,而是在select中使用ng-model和ng-change。适用于Chrome和IE