Answer the question
In order to leave comments, you need to log in
What is the result of this assignment?
I found the following code in the source code of the service: var self = $rootScope.$service_name = this;
$service_name - the service itself. Can you tell me what this code does? Puts a service instance in $rootScope and assigns it to self? Why is such a trick needed?
Answer the question
In order to leave comments, you need to log in
Why assign a service object to $rootScope - I don't know. Probably some kind of global helper.
Assignment to self - not to lose context in callbacks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question