Creating a Polling Application Using AngularJS and Laravel Part 2
A Single Page Application usually rely on a remote server to store and retrieve data using Ajax calls. Making such calls directly inside controllers can clutter the code base with unnecessary repetitions of the similar logic. In this kind of situations, injecting a functionality as a service can reduce the size of the controllers and at the same time makes our code more testable and reusable.
In this section, we will create a pollService which will allow our polling application to communicate with the Laravel RESTful API to retrieve and save the data.