Is it possible (and a good idea) to set a model (scope vars) in a factory service?
For example, I have a factory which defines a model below how can I now init this in the controller?
(function () {
'use strict';
angular.module('services.auth', [])
.factory('AuthorisationService', function ($rootScope, $http) {
// Public variables
var authService = {
user: {
email: '',
password: ''
}
};
return authService;
});
})();
controller:
.controller('LoginCtrl', ['$scope', 'AuthorisationService', function ($scope, AuthorisationService) {
AuthorisationService();
};
}]);