我是发布还是删除等都没关系。我会这样写:
$http({
method: ''
url: '',
data: '',
headers: ''
}).success(function(data, status, headers, config) {
//whatever happens on success
}).error(function(data, status, headers, config) {
//whatever happens on failure
});
执行上述操作或执行此操作有什么区别:
$http({
method: ''
url: '',
data: '',
headers: ''
}).then(function(response) {
//success
},
function(response) {
//failed
};
一个比另一个有优势吗?是不是后来出现了,没有太大区别?只是想知道真正的差异以及人们喜欢使用什么以及为什么。