var app = angular.module('login', []);
app.controller('LoginController', ['$scope', '$http', function
($scope, $http) {
this.error='test';
this.submitForm = function () {
var params = $("#loginForms").serialize();
$http({
method: 'POST',
url: '/admin/doLogin',
data: params,
}).then(function (response) {
// this callback will be called asynchronously
// when the response is available
}, function (response) {
$scope.error = response
console.log(response.status)
if (response.status == 404) {
this.error = "Page not found";
}
});
}
}]);
am trying to set the error message inside the process and bind it to view
<div id="container" ng-controller="LoginController as lm" >
<br>
<div class="error" >{{lm.error}}</div>
</div>
i am trying to change the error variable in promise reject event.this is not working ,please help