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