ng-click 在 IE 中不起作用,但在 CHROME 中工作正常 [英] ng-click not working in IE but works fine in CHROME

查看:33
本文介绍了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() 在我点击特定选项时没有被调用

arrayPush() is not being called when I am clicking a specific option

$scope.arrayPush = function(){alert("Hello!");}

推荐答案

我刚刚找到了我问题的答案

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>

在选择中使用 ng-model 和 ng-change 而不是使用 ng-click in 选项.适用于 Chrome 和 IE

Instead of using ng-click in option, use an ng-model and ng-change in select. Works in both Chrome and IE

这篇关于ng-click 在 IE 中不起作用,但在 CHROME 中工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆