If you use syntax controller as, you can add your controller functions to it instead of one massive function. eg.
var MyController = function($http) {
this.$http = $http;
}
MyController.$inject = ['$http'];
angular.module('myApp').controller('MyController', MyController);
MyController.prototype.someFunc = function() {
return this.$http.get('something');
}
source
share