Angular HttpClient Blob
This is an example application for using Angular's HttpClient "blob" response type.
First, install dependencies:
$ npm install
Next, run the gulp tasks, then start the Node.js Express server.
$ gulp $ chmod +x ./dist/bin/www $ ./dist/bin/www
Then, serve the Angular client using the CLI:
$ ng serve
- Create a simple Express Node.js HTTP server.
- Mock an image/jpeg image response. This is just hard coded.
- Create a simple Angular application to display heros.
- Viewing a hero displays the hero's name and associated image. Again, the image is always the same since I hacked this portion.
- Show how to retrieve the JPEG image using the HttpClient with the responseType option set to "blob".
- Show the image from the blob.
This application is based on a blog post I wrote: