Encountering this issue:
Error: [$injector:unpr] http://errors.angularjs.org/1.5.6/$injector/unpr?p0=DataServiceProvider%20%3C-%20DataService%20%3C-%20SignupController
Suspecting that the problem lies in the fact that DataService
cannot be found due to being defined in a separate directory. Or could it be a case of incorrect definition?
SignUpController (part of the main app, located in src/public/xxx/xxx.controller.js
):
var app = angular.module('app');
SignupController.$inject = ['DataService'];
function SignupController(DataService) {
// implementation
}
app.controller("SignupController", SignupController);
DataService resides in data/dataservice.js
function DataService(){
// implementation
}
var datamodule=angular.module('data');
datamodule.service('DataService',DataService);
Assuming 'data' has been properly declared in data/data.module.js
angular.module('data', []);
and has been incorporated into the main app in src/public/xxx/xxx.js
angular.module('app', ['ui.router', 'common','data']);
Order of References:
<script src="data/data.module.js" type="text/javascript"></script>
<script src="data/dataservice.js" type="text/javascript"></script>
<script src="src/public/xxx.js" type="text/javascript"></script>
<script src="src/public/xxx/xxx.controller.js" type="text/javascript"></script>