How can I use a factory inside a “resolve” of $stateProvider?
问题 As title I want to use a factory insisde a "resolve" app.js: angular .module("goHenry", ["ui.router"]) .factory("httpPost", httpPost) .controller("MainCTRL", ["$scope", MainCTRL]); function MainCTRL($scope, httpPost){ this.nameApp = "CiaoMiao"; console.log($scope.children, httpPost); } function httpPost($http, $q){ return { get: function() { var deferred = $q.defer(); $http.post.apply(null, arguments) .success(deferred.resolve) .error(deferred.resolve); return deferred.promise; } }//RETURN }