ng-click not working in IE but works fine in CHROME

*爱你&永不变心* 提交于 2019-12-11 02:45:41

问题


<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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!