I have Angular.js web application with service UserModel and controller - Users.
UserModel:
/*
* User model service
*/
angular.module('my_mode_ext').factory('UserModel', [function(){
// user model
var model = [];
//
// Return users model
//
model.get = function(){
// some object
model = {.........};
// return model
return model;
}
return model;
}]);
I try to use it in controller:
var UsersController = ['$scope', '$rootScope', '$http', '$route',
function($scope, $rootScope, $http, $route, UserModel, ngTableParams){
console.log('UserModel ' + UserModel);
.....
}];
But got undefined in UserModel and error that:
Error: Unknown provider: UserModelProvider <- UserModel
How to fix it?
UPD. I found problem. Actually this service and controller are in other module than another application but i can't do just:
angular.module(my_main_module, ['my_mode_ext'])
Because i load this script in work time of web application. How to load module dynamically in angular application?
Thank you.
UserModel...