So now we need to connect our frontend to our backend. Instead of rendering data in our page on load, we want to use AJAX to connect and do all of our CRUD. Fortunately for us, Angular has a pretty elegant way of handling this.
Let's say that different parts of our application may need access to some of the same data endpoints, or some other functionality. A great way to handle this is with an AngularJS provider. A provider is essentially an injectable singleton, and there are a number of options available - see https://docs.angularjs.org/guide/providers.
The provider type we are going to use is a factory. Let's start by creating a services
directory inside our public/javascripts
directory. Create a new file called giftlistFactory.js
inside that directory:
angular.module('giftlistServices', []) .factory('List', function(){ return {} });
We've created another module for services, and then created a factory...