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


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

我刚刚找到了问题的答案

<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

单击选项,而是使用 ng 模型和 ng 更改选择。适用于Chrome和IE

最新更新