2014-01-21 34 views

回答

2
$http.post('path/to/api', jsonData).then(function(resp) { 
    console.log(resp.data); 
}); 

這是簡寫:

$http({ 
    method: 'POST', 
    url: 'path/to/api', 
    data: jsonData 
}).then(function(resp) { 
    console.log(resp.data); 
}); 

這裏是所有可用的短針的方法:

$http.head 
$http.post 
$http.put 
$http.delete 
$http.jsonp 

See the docs here (click).

+1

第二個例子是不等同於第一因爲你沒有使用jsonData。 – lucuma

+0

@lucuma良好的通話,我累= D – m59

+0

感謝您的快速反應m59。我需要將json對象解析爲平面文件嗎? – Arjit

相關問題