2016-07-05 1 views
0

我々は、角のjs

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); 

    }; 

}でウェブAPI2方法を消費することはできません。

答えて

0

あなたは実際にサーバーに触れていますが、応答を読み取っていません。 $ httpは約束を返すので、正しい方法は:

$http.post(utils.apiUrl('admin/login', credentials, config).then(function(response) { 
    return response; 
}); 
+0

実際には角度コントローラに戻っています。 service.jsのこの関数 – Biranchi

関連する問題