angularjs 保存数据 和 check

来源:互联网 发布:tracert linux 编辑:程序博客网 时间:2024/05/21 08:35
// 保存信息(新增/修改)
$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, status, headers, config) {
$scope.error = "保存时,发生系统异常。";
$scope.btnSaveEnable = true;
});

};

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

 return true;

};


0 0
原创粉丝点击