Reputation: 10703
<html>
<head>
</head>
<body>
</body>
</html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular.min.js"></script>
<script type="text/javascript">
var appName = "renameMe";
var fooModule = angular.module("foo", []);
var app = angular.module(appName, ["foo"]);
//var app = angular.module(appName, ["ui.router"]);
app.config(["foo", function (foo) {
}]);
angular.element(function () {
angular.bootstrap(document, [appName]);
});
</script>
I cannot figure out how to fix my code from getting the below error. Why am I getting this error and how can I fix it?
My End game is to have a standalone module injected into
app.config(["foo", 'function(foo){}]);
So I can run some custom code
Error: $injector:unpr Unknown Provider Unknown provider: foo
Upvotes: 1
Views: 175
Reputation: 222493
foo
module is already included to renameMe
module with
var app = angular.module(appName, ["foo"]);
While
app.config(["foo", function (foo) {...}]);
expects that there will be foo
service (more specifically, constant
service). If there is none, $injector:unpr
error is triggered.
If there is supposed to be no foo
service, it should be just
app.config(function () {...});
Upvotes: 1