如果服务器响应错误,如何保持打开编辑模式?现在,当我单击提交并将数据发送到 API 时,我的表单会自动关闭,但我只想在服务器响应成功时关闭编辑模式,如果响应错误则保持打开状态。谢谢
<form editable-form name="tableform" onaftersave="saveTableConfig()" oncancel="cancel()">
<span editable-textarea="currentKlupa.description" e-name="description" e-
rows="3">Text</span>
</form>
$scope.saveTableConfig = function () {
var config = {
headers: {
'Content-Type': 'application/xml',
'X-HTTP-Method-Override': 'PUT'
}
};
var configCopy = angular.copy($scope.currentConfig);
$http.post(serviceBase + 'cd/saa/' + $stateParams.aaaID + '/config', configCopy, config)
.success(function (data, status, headers, config) {
Notification.success({message: $filter('translate')('BENCH_EDITED_SUCCESSFULLY'), delay: 3000, positionY: 'bottom', positionX: 'right'});
})
.error(function (data, status, header, config) {
Notification.error({message: $filter('translate')('BENCH_EDITED_ERROR'), positionY: 'bottom', positionX: 'right'});
});
};