philippd / angular-deferred-bootstrap

Initialize your AngularJS app with constants loaded from the back-end.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consuming services of same module

thetutlage opened this issue · comments

How can i consume services or factories which are part of the same module

var app = angular.module('angularApp', []);

// Resolve block while bootstrapping

deferredBootstrapper.bootstrap({
      element: document.body,
      module: 'angularApp',
      injectorModules: 'angularApp',
     resolve: function($http,$timeout,$q,Message){
        var deferred = $q.defer();
         $timeout(function(){
         deferred.resolve(Message.name);
        },2000);
        return deferred.promise;
     }
 });

// Factory
app.factory('Message',function(){
   return{
    name: 'Nice Name'
  }
});

After writing the above code my routes stop working, and if i remove angularApp from injectorModules , routes start working but the resolve method gives an error that

Message provider not found

I know i can move Message factory to a different module , what if i do not want to do so. is there any other option

Closing , it was because of something else