Can $q and $http be injected in the .config section

前端 未结 3 641
余生分开走
余生分开走 2020-12-18 20:58

Is it possible to inject $q in the config section of my module? Below is my sample config section.

.config([\'$q\', function ($q) {
    var func = function (         


        
3条回答
  •  孤城傲影
    2020-12-18 21:22

    It is possible for me (when routing configure):

    resolve: {
       simpleStringParam: ["$q", "$timeout", function($q, $timeout){
          var deferred = $q.defer();
              $timeout(function(){
                  deferred.resolve("Allo!");
              },8000);
          return deferred.promise;
       }]
    }
    

提交回复
热议问题