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

Uploading product images

For the time being, we have been using a placeholder for the product images. Let's again wire the client with the server to handle image upload. For the frontend, we are going to use ng-file-upload, and for the backend, we are going to use a middleware called connect-multiparty.

Uploading files in Angular

File upload is not very straightforward in Angular. We cannot just bind to an input file HTML tag and expect it to work. Fortunately, there are plenty of libraries out there, like the one we are using, to solve the problem. Let's install ng-file-upload:

bower install ng-file-upload --save
bower install ng-file-upload-shim --save

This library has useful features such as drag and drop, validation, file upload progress, cancel ...

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