vehiclelistServices.factory('VehicleListService', ['$http','$q', function($http,$q){
return {
getUserPrefs : function(url){
var d = $q.defer();
$http.defaults.cache = false;
if (!$http.defaults.headers.get) {
$http.defaults.headers.get = {};
}
// disable IE ajax request caching
$http.defaults.headers.get['If-Modified-Since'] = '0';
$http.get(url)
.success(function(data, status, headers, config){
d.resolve(data);
});
return d.promise;
},
saveUserPrefs : function(state,url){
var d = $q.defer();
$http.post(url, state)
.success(function(data, status, headers, config) {
d.resolve(data);
});
return d.promise;
},
getVehicleList : function(url){
var d = $q.defer();
$http.defaults.cache = false;
if (!$http.defaults.headers.get) {
$http.defaults.headers.get = {};
}
// disable IE ajax request caching
$http.defaults.headers.get['If-Modified-Since'] = '0';
$http.get(url)
.success(function(data, status, headers, config) {
d.resolve(data);
});
return d.promise;
}
};
}]);
任何人都可以帮我写业力测试功能