您好我正在做與web api作爲前端的angularjs應用程序。當某些用戶沒有權限某些我回到Httpresponsemessage作爲如何在angularjs中顯示錯誤消息(404)
var message = string.Format("You do not have permission");
HttpError err = new HttpError(message);
return Request.CreateResponse(HttpStatusCode.NotFound, err);
我想在角提醒上述消息,我下面想。
$scope.Update = function() {
var servCall = ProjectSetting_Service.update(sub);
servCall.then(function (data) {
alert(JSON.stringify(data));
});
}, function (error) {
//How to alert message here
}
我可以在這裏得到一些幫助!任何幫助,將不勝感激。謝謝。
嘗試'的console.log( '錯誤',錯誤);在'你的errorCallback函數並顯示響應,你可以這樣做alert(error.data.message);' – nivas