0

UPDATE: I understand that $window cannot be pick up (i.e. other post) but what is my alternative to get that global variable into my .config??

I am having issues with $window, I have a global variable set on my main page and I am trying to get angularJS to pick up on it but this is the error I get:

> Uncaught Error: [$injector:modulerr] Failed to instantiate module docMan due to: Error: [$injector:unpr] Unknown provider: $window

As you can see below I try to inject it into the .config, I did the same in the controller but it still doesn't let me us it, not sure why... Any help would be appreciated!

 app.config(['$httpProvider','$window',function ($httpProvider, $window) {
     var sessionId = $window.__sfdcSessionId;
     $httpProvider.defaults.useXDomain = true;
     delete $httpProvider.defaults.headers.common["X-Requested-With"];
     $httpProvider.defaults.headers.common["Access-Control-Allow-Origin"] = "*";
     $httpProvider.defaults.headers.common["Accept"] = "application/json";
     $httpProvider.defaults.headers.common["content-type"] = "application/json";
     $httpProvider.defaults.headers.common['Authorization'] = "OAuth " + sessionId ;
     $httpProvider.defaults.headers.common['X-User-Agent'] = "MyClient" ;
    }]) ; 
Tekill
  • 1,171
  • 1
  • 14
  • 30
  • So what is my alternative here to pick up on a global variable??? – Tekill Nov 11 '15 at 19:10
  • I swith .config to .run and now I get this error: [$injector:unpr] Unknown provider: $httpProviderProvider <- $httpProvider – Tekill Nov 11 '15 at 19:23

0 Answers0