ng-click在IE中不起作用,但在CHROME中工作正常

时间:2013-11-26 07:04:38

标签: javascript angularjs angularjs-ng-click

<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!");}

1 个答案:

答案 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