add primitive error ajax error handling for visits page

This commit is contained in:
Dapeng 2016-09-21 13:14:44 +08:00
parent 3c4d95edcf
commit a849f8ef0b

View file

@ -26,8 +26,11 @@ angular.module("visits").component("visits", {
console.log(data);
$http.post(url, data).then(function() {
$location.url("owners/" + $routeParams.ownerId);
}, function() {
}, function (response) {
var error = response.data;
alert(error.error + "\r\n" + error.errors.map(function (e) {
return e.field + ": " + e.defaultMessage;
}).join("\r\n"));
});
};
}]