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({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) {// resp是一个响应对象}, function(resp) {// 带有错误信息的resp});
var promise = $http({method: 'GET',url: '/api/users.json'});promise.success(function(data, status, headers, config) {// 处理成功的响应});promise.error(function(data, status, headers, config) {// 处理非成功的响应});