I encountered the following error message:
Unknown provider: UserModelProvider <- UserModel <- PropertyService
The issue arises from injecting the User model into a particular service.
Interestingly, when I inject it into a different service, everything works perfectly fine.
Works =
angular
.module('app')
.service('JunkService', junkService);
junkService.$inject = ['$http', 'UserModel'];
function junkService($http, UserModel) {
Does NOT work =
angular
.module('app')
.service('PropertyService', propertyService);
propertyService.$inject = ['$http', 'UserModel'];
function propertyService($http, UserModel) {
Both Junk and Property services are injected into their respective controllers, functioning in the Junk controller but not in the Property one...
Any insights on this matter?
This is how the Model is structured:
angular
.module('app')
.factory('UserModel', userModel);
function userModel() {
function User(firstName, lastName, role, organisation) {
// Public properties, assigned to the instance ('this')
this.firstName = firstName;
this.lastName = lastName;
this.role = role;
this.organisation = organisation;
}
return User;
}
})();