gistfile1.js �+,�U >�,�U // Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc // jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ // author: Pawel Kozlowski var myApp = angular.module('myApp', []); //service style, probably the simplest one myApp.service('helloWorldFromService', function() { this.sayHello = function() { return "Hello, World!" }; }); //factory style,
![Difference between Service, Factory and Provider in AngularJS](https://cdn-ak-scissors.b.st-hatena.com/image/square/1ef26f6cb4349557952890dbe3e567f7f98dc151/height=288;version=1;width=512/https%3A%2F%2Fgithub.githubassets.com%2Fassets%2Fgist-og-image-54fd7dc0713e.png)