我想使$http
請求利用配置對象而不是快速方法。該請求是'GET'方法,並且該URL針對的是本地文件json
。
代碼看起來多少有點像:
$http.get({
method: 'GET',
url: 'data.json'
}).then(function(res) {
$scope.data = res;
}, function(res) {
console.log(res);
})
我得到的錯誤是:
Error: [$http:badreq]
這裏的 '工作' plunker證明的問題。
事實是,如果我使用快速方法$http.get('clients.json')
它的作品。
任何幫助,將不勝感激。
我已經提到過兩次**我不想使用快捷方式**。但是配置對象。 – Korte
我想你用get類型twice.change從$ http.get獲得({to $ http({ – Amal
哦,有人是盲人,非常感謝! – Korte