Angular 2 encode image to base64
<p>I want to encode the uploaded files to base64 so that I can pass them to the request. The problem is that I'm using Angular 2 with Typescript and I couldn't find any info on how to do that. I found that in Javascript it can be done with canvas but I don't know how could I implement the code in Typescript.</p>

<pre><code>&lt;input type="file" class="form-control" accept="image/*" multiple
    [(ngModel)]="spot.images" name="images"&gt;
</code></pre>