我如何將正常的RestApi改變成angularjs中的http post請求?如何我可以改變正常的RestApi成angularjs中的http post請求
我想發送這個url作爲$ http - 在angularjs函數中的post請求。
http://localhost:3001/ams/v2/folder?name=SampleCCCCCC
我的代碼:
$http.post('http://localhost:3001/ams/v2/folder?name=SampleCCCCCC', data, config)
.success(function(data, status, headers, config) {
console.log("Server request is sending");
})
.error(function(data, status, header, config) {
console.log("Server request is NoT sending");
});
錯誤,我越來越:
Error: data is not defined
[email protected]://localhost:3000/app/components/assetmanagement/controllers/library.FolderCreation.js:76:6
anonymous/[email protected]://localhost:3000/bower_components/angular/angular.js line 13275 > Function:2:194
@http://localhost:3000/bower_components/angular-touch/angular-touch.js:478:9
$RootScopeProvider/this.$get</[email protected]://localhost:3000/bower_components/angular/angular.js:15922:16
但是,這是行不通的。任何想法請?
已經給任何思想實際...做了谷歌搜索? – sirrocco
@sirrocco:我複製了我的代碼,這是我試過的.. – User123
@ User123 - 你在控制檯中得到的錯誤是什麼? –