I'm facing an issue when trying to inject a service into a controller in a Yeoman AngularFire application.
Below is the controller (generated by Yeoman) where I am attempting to inject user
:
angular.module('myYoApp')
.controller('ChatCtrl', function ($scope, user, Ref, $firebaseArray, $timeout) { ....
This results in an error stating Unknown provider
:
angular.js:12798 Error: [$injector:unpr] Unknown provider: userProvider <- user <- ChatCtrl
Interestingly, it works perfectly in my custom controller, allowing me to access the user in the associated view.
angular.module('myYoApp')
.controller('myCtrl', function ($scope, user, Auth, Ref, $firebaseArray, $firebaseObject, $timeout) { ....
I'm puzzled as to why the user
service can be injected in my custom controller but not in the Yeoman-generated ChatCtrl
. I've searched throughout the project but couldn't locate where the user
service is defined. However, since my custom service can use it, it must exist within the app somewhere.
I also attempted using $user
instead of user
, but that didn't resolve the issue.
Any insights on solving this puzzle would be greatly appreciated!