How could i prove with a sample code that angular service and factory is singleton
- angular.module('myApp').service('helloService',function($timeout){
- this.sayHello=function(name){
- $timeout(function(){
- alert('Hello '+name);
- },2000);
- }
- });
-
- angular.module('myApp').controller('TestController',
- function(helloService){
- helloService.sayHello('AngularJS');
- });
so please come with a example code which tell me when i will run that angular service and factory is singleton. thanks