angularjs 保存数据 和 check

前端之家收集整理的这篇文章主要介绍了angularjs 保存数据 和 check前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
// 保存信息(新增/修改
$scope.save = function() {
// 防止二次提交

$scope.btnSaveEnable = false;
$scope.error = "";

// check
if (!inputCheck()) {
// 防止二次提交
$scope.btnSaveEnable = true;
return;
}

$scope.searchInfo.type=$("#type").val();

$http({

method : "post",
url : "find/save",
data :$scope.searchInfo
}).success(function(rs,status,headers,config) {
if (rs.status == 0) {
$scope.success = "操作成功。";
var back = 1;
location.href = base + "/backplayroom-" + back;
} else {
$scope.error = rs.message;
$scope.btnSaveEnable = true;
}
}).error(function(rs,config) {
$scope.error = "保存时,发生系统异常。";
$scope.btnSaveEnable = true;
});

};

function inputCheck() {
if (isEmpty($scope.searchInfo.playbackName)) {
$scope.error = "请输入回播室名称";
return false;
}

return true;

};

猜你在找的Angularjs相关文章