AngularJs的List属性在ie11中不起作用

AngularJs List attribute does not work in internet explorer 11

本文关键字:ie11 不起作用 属性 List AngularJs      更新时间:2023-09-26

我有一个范围,我正在使用find。它在chrome工作,但在Internet explorer 11不工作我怎样才能使它在IE 11中工作?

$scope.NameList= [];
$scope.addRow = function () {
    if ($scope.NameList.find(findName)) {
        $scope.error = "Already in the list";
    }
}

ie浏览器不支持Array上的find方法。您必须使用indexOf,然后访问键(如果存在)。