What Are Services?
In a nutshell, services are a way of making functions and variables global. They can be injected as dependencies in any controller and its functions/variables can be accessible across controllers.
Creating the Service
- Create service file
- Make sure the names are consistent
- Include the name of the service function in the controller’s function(…, …)
- Can now use the functions and variables in any controller that you included the dependency for. Simply call: