convert image to base64 in angularjs

前端 未结 4 1083
自闭症患者
自闭症患者 2020-12-28 20:37

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 pl

4条回答
  •  一整个雨季
    2020-12-28 21:02

    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'])
    

提交回复
热议问题