Factory vs Service
angularjs factory vs service do the same thing, just a different way of instantiation
HTML
<div ng-controller="View1Ctrl">
</div>
JavaScript
angular.module('myApp', [])
.controller('View1Ctrl', ['$rootScope','$location', 'fakeProvider', function($rootScope, $location, fakeProvider) {
}])
.provider('fakeProvider', function () {
this.$get = ["$rootScope", function ($rootScope, $location) {
$rootScope.$on('$locationChangeStart', function (event, next, current) {
console.log("location change start from the provider's code: " + current + ' next: ' + next);
});
}];
});