Search code examples
angularjsimage-conversion

convert image to base64 in angularjs


I have a requirement where user will upload their image and i have to convert it into something and send it to .Net REStful service. I am new to angular js. Could someone please help


Solution

  • Answer from here https://stackoverflow.com/a/24880314/625189

    I would recommend you to use https://github.com/ninjatronic/angular-base64.

    After following instructions for using this library, you can simply call:

    var imageData=$base64.encode(image);
    

    Don't forget to inject in your module:

    .module('myApp', ['base64'])