angularjs $http调用接口的方式:
$http.get("/merchantmall/merchant.json")
.success(function(data, status, headers, config) {
console.log(arguments);
})
.error(function(data, status, headers, config) {
console.log(arguments);
})
$http({method:"GET", url: "/merchantmall/merchant.json"})
.success(function(data, status, headers, config) {
console.log(arguments);
})
.error(function(data, status, headers, config) {
console.log(arguments);
})
var promise = $http({method: 'GET', url: '/api/users.json'});
promise.then(function(resp) {
console.log(resp);
}, function(resp) {
console.log(resp);
});
var promise = $http({
method: 'GET',
url: '/api/users.json'
});
promise.success(function(data, status, headers, config) {
console.log(arguments);
});
promise.error(function(data, status, headers, config) {
console.log(arguments);
});