TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
tri_inn
NA
1.2k
233.5k
AngularJS: service and factory is singleton ?
Jun 12 2017 10:36 AM
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
});
so please come with a example code which tell me when i will run that angular service and factory is singleton. thanks
Reply
Answers (
3
)
AngularJS: factory and share data between controllers
AngularJS: infinite scroll with ng-repeater