You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm a little confused after reading your post here:
From AngularJS docs
AngularJS services are:
Singletons – Each component dependent on a service gets a reference to the single instance generated by the service factory.
My confusion is, if they are singletons why do you instantiate them using 'new' keyword? My understanding was you could just include them as dependency and use the service methods, just like $http.
And factory, as the name implies, is responsible for creating instances of objects and you would use 'new' to instantiate those objects.
Am I missing something here? Is there a concept I'm failing to understand here?
The text was updated successfully, but these errors were encountered:
I'm a little confused after reading your post here:
From AngularJS docs
My confusion is, if they are singletons why do you instantiate them using 'new' keyword? My understanding was you could just include them as dependency and use the service methods, just like $http.
And factory, as the name implies, is responsible for creating instances of objects and you would use 'new' to instantiate those objects.
Am I missing something here? Is there a concept I'm failing to understand here?
The text was updated successfully, but these errors were encountered: