如果记录已经在数据库中退出并显示警告消息,我想停止foreach循环。
angular.foreach(data, function (value, key) {
if ($scope.serviceNameAttribute == value.name) {
count++;
alert("Attribute already exists");
return false;
}
if ($scope.displayNameAttribute == value.name) {
count++;
alert("Attribute already exists");
return false;
}
if ($scope.serviceNameAttribute + ' ' + $scope.displayNameAttribute == value.name) {
count++;
alert("Attribute already exists");
return false;
}
});
请在显示警告消息后找到所附的代码,如果表中有重复记录,则会多次显示警告消息