What is a Factory?
An Angular service is a singleton object created by a service factory.
Registers a service factory function, fn, that will be wrapped in a service provider object, whose $get property will contain the given factory function.
More info, visit Angular site
In Factory, you can reuse your code and share your code between controllers.
We will see our previous example, how we incorporate Factory.
Here we move the data and methods from Controller into Factory.