O'Reilly logo

Web Application Development with MEAN by Robert Onodi, Adrian Mejia, Amos Q. Haviv

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 */ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required