var sdApp = angular.module("sdApp", []);
//订单;
//服务;
sdApp.service("orderService", ["$http", function(a){
var s = {
searchData : function(data){
a({
method: "post",
url: "/?app_act=/orders/ajax_order_list&app_fmt=json",
data: $.param(data),
headers: {"Content-Type":"application/x-www-form-urlencoded", "x-camnpr-uid":"1000"}
}).success(function(res){
console.log(res);
return res;
});
}
};
return s;
}]);
//控制;
sdApp.controller("orderSearchCtrl", ["$scope", "$http", "orderService", function(a, b, c){
//搜索;
a.search = function(){
a.res = c.searchData(a.orData);
console.log(a.res);
};
}]);
Why is the a.res output from console.log undefined?
searchData()
没有return
一个返回值,默认就是undefined