Hi I am doing angularjs application with web api as front end. Whenever some user do not have certain permission I am returning Httpresponsemessage as
var message = string.Format("You do not have permission");
HttpError err = new HttpError(message);
return Request.CreateResponse(HttpStatusCode.NotFound, err);
I want to alert above message in angular and I am trying as below.
$scope.Update = function () {
var servCall = ProjectSetting_Service.update(sub);
servCall.then(function (data) {
alert(JSON.stringify(data));
});
}, function (error) {
//How to alert message here
}
May I get some help here! Any help would be appreciated. Thank you.
console.log('error', error);in your errorCallback function and show the response, you can do thisalert(error.data.message);