gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 05:42:08 25 4
gpt4 key购买 nike

<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-click,而是在选择中使用 ng-model 和 ng-change。适用于 Chrome 和 IE

关于javascript - ng-click 在 IE 中不起作用,但在 CHROME 中工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20210546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com