问题
<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() is not being called when I am clicking a specific option
$scope.arrayPush = function(){alert("Hello!");}
回答1:
I just found-out the answer to my question
<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>
Instead of using ng-click in option, use an ng-model and ng-change in select. Works in both Chrome and IE
来源:https://stackoverflow.com/questions/20210546/ng-click-not-working-in-ie-but-works-fine-in-chrome