CRUD-ing products with AngularJS

So far, we have all the products showing in the /products path. If we click on details, nothing happens. Let's fix that, and also add the rest of the CRUD (create-read-update-delete) functionality.

Services

We will build a server-less CRUD; the data will be stored in memory. Nonetheless, when we build the RESTful API in the next chapter, we just need to replace our in-memory storage for the $http service. The rest of the application would remain working the same way.

For that, let's refactor our product service to return public methods: Query to return all the products and get to get a single product from the collection. Edit, create, and update are self-explanatory:

/* clients/app/products/products.service.js */ ...

Get Web Application Development with MEAN now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.