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);
};
}]);
为什么console.log出来的a.res是undefined?
searchData()
tidak mempunyai nilai pulanganreturn
, lalainya ialahundefined