Form a normal usage perspective both the Service and Factory provide the same functionality, both Service and Factory
are Singleton, however there are few
differences between the two, let us see on how they differ.
When we invoke a service it returns an instance (object representation) of the function, which is more like initializing the object with new and returning the instance.
When we invoke a factory it returns a class representation of the function, the calling Function/Controller can initiate the response (new). Following is the Syntax for Service and Factory
When we invoke a service it returns an instance (object representation) of the function, which is more like initializing the object with new and returning the instance.
When we invoke a factory it returns a class representation of the function, the calling Function/Controller can initiate the response (new). Following is the Syntax for Service and Factory