AngularJS
AngularJS AngularJS Service It’s actually better to use services where possible, when it comes to migrating to ES6. The reason for that is simply that a service is a constructor function and a factory is not. Working with constructor functions in ES5 allows us to easily use ES6 classes when we migrate to ES6. module . service ( 'MyService' , function () { this . method1 = function () { //..method1 logic } this . method2 = function () { //..method2 logic } }); AngularJS Factory module . factory ( 'MyFactory' , function () { var factory = {}; factory . method1 = function () { //..method1 logic } factory . method2 = function () { //..method2 logic } return factory ; }); AngularJS Controller angular.module( 'myApp' ) .controller( 'AdminCtrl' , [ '$scope' , 'admin' , 'AUTH_...