If code is requesting data from an API or database, it should probably be in a service
angular.service
vs angular.factory
Basic Setup of an Angular Factory (IIFE excluded for brevity)
angular
.module('myModule')
.factory('myFactory', myFactory);
function myFactory() {
var service = {};
return service;
}
register
property on it. Continue adding additional properties to the factory to refactor the other methods and dependencies in the AuthController
Mutant Office Hours: Source