我们无法在角度js中使用web api2方法
module.exports = function ($http, utils) {
var self = this;
self.login = function (credentials) {
var config = {
headers: {
//'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'
'Content-Type': 'application/json'
}
};
return $http.post(utils.apiUrl('admin/login'), credentials, config);
};
};
答案 0 :(得分:0)
您实际上正在触摸服务器,但没有阅读响应。由于$ http返回一个promise,正确的方法是:
$http.post(utils.apiUrl('admin/login', credentials, config).then(function(response) {
return response;
});