app.provider('BackEndList', function() {
this.list = [];
this.setBackEndList = function(list) {
if (list) {
this.list = list;
}
};
this.$get = function($http, $httpParamSerializerJQLike) {
var t = this,
href = window.location.href,
testStr = "";
if (href.indexOf('localhost') > -1 || href.indexOf('192.168') > -1)
testStr = "/Mock";
var service = {};
angular.forEach(this.list, function(value) {
service[value.name] = function() {
return $http({
url: see.getUrlPrefix(true) + value.url + testStr,
mothod: value.method || "get",
dataType: value.dataType || "json"
});
};
});
return service;
};
});
app.config(function (BackEndListProvider) {
BackEndListProvider.setBackEndList([{
name: "getYearIndex",
url: "/act/actShoppingYear/getActivity"
}, {
name: "getCoupon",
url: "/act/actShoppingYear/getCoupon"
}, {
name: "getShareCoupon",
url: "/act/actShoppingYear/getExtraCoupon"
}]);
});