What is a Service?
Register a service constructor, which will be invoked with new to create the service instance. This is short for registering a service where its provider’s $get property is the service constructor function that will be used to instantiate the service instance.
More info, visit Angular site.
We will see our previous Factory example, how we incorporate Service.
Here we change Student Factory and Enrollment Factory into Student Service and Enrollment Service.
Change the Student and Enrollment Controllers to use Service instead of Factory.
Change the Index view to use the Service js files instead of Factory js files.
There will be no change in App.js and views