define(['app'], function(app){ function HttpService($scope, $q, $http, appConfig){ var url = appConfig.BASE_URL, ret = {ok: 0, data: {ok: 0}}; function getA(){ var deferred = $q.defer(); deferred.resolve(ret.data); // 模拟请求成功 return deferred.promise; } function getB(){ var deferred = $q.defer(); deferred.resolve(ret.data); return deferred.promise; }; return { getA: getA, getB: getB } } return app.factory('HttpService', [ '$scope', '$q', '$http', 'appConfig', HttpService ]);});注入$scope,报错干掉$scope,能正常跑求解
添加回答
举报
0/150
提交
取消