Tuesday 16 May 2017

angularjs service to load image base64 from backend file

I have a function in my service that has an image variable:

(function () {
    'use strict';
    angular
        .module('my-app')
        .service('myService', myService);

    /** @ngInject */
    function myService() {
        var me = this;
        function myfunction(){
             var image = 'data:image/jpeg;base64,/9j/4AAQGkZJCgABAQED3ADcAAD.....';

             // i use that 'image' here...
         }

Question:

  • How can I load the same image myimage001.jpeg which is stored in my backend? and pass it as base64
  • How can I store the image filename in a config file in backend, which will hold the raw path to this file, and later I load the image variable from this config file and pass into this frondend service?

Thanks



via passion

No comments:

Post a Comment