Reputation: 2363
I have two modules, module A
and module B
, who depend on each other.
Module A
is being bootstrapped
. Module A
defines a provider
which I want to inject into the config block of module B
. But I only get Unknown provider
errors:
Failed to instantiate module A due to:
Error: [$injector:modulerr] Failed to instantiate module B due to:
Error: [$injector:unpr] Unknown provider: testProvider`
Here is the Plunkr, it's super simple, but I don't get why it doesn't work.
Upvotes: 0
Views: 142
Reputation: 7605
In your example, the A module depends of B that himself depends of A. You can't do that, it's wrong.
Since you're A module doesn't really depends of B, just remove it from the declaration:
var A = angular.module('A', []);
The exception will go away.
You also need to change the ng-app
value:
<html ng-app="B">
See fixed Plunker.
Upvotes: 2