Download files via POST request in AngularJs

There are times when you need to download file but the download is initiated via POST request, because the request contains too much parameters to fit into limited GET request. In my case I needed to generate ZIP file. First you need to define custom method on your $resource which will handle the download method, like in the example below. Have a look at the transformResponse method. It creates a Blob from the server response (binary representation of the Zip file) and tries to extracts the file name from response headers. Then you need to define method on controller. User clicks button “Download ZIP”, your …

Continue Reading

Blurry images in html5 canvas

Why <canvas> draws blurry images? Did it happen to you as well? I found fairly simple tutorial, and tried to code according to its advice. The result is shown below. Big blurry cat … Then I tried to copy paste the code, but with almost identical result. Again I got a blurry  image.  Next day I found out that I have to specify attributes width and height directly on the canvas element. It is not enough to set it via css. It doesnt not make any sence to me, because it is good practise to separate html markup and stylesheets. …

Continue Reading