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'); // Alerts Hello AngularJS
- });
Posted Jun 14, 2017, 5:53 AM
Input is : {{data.firstName}}
Posted Jun 13, 2017, 5:17 AM
Manikandan MurugesanPosted Jun 12, 2017, 10:59 AM