2

I need to display the QR code image in the html using angularjs. I have a Qr code image in the rest controller and i need to display in the html using angularjs Here is my angularjs controller with directives used code:

$http.post("../rest/a/save").then(function(response){
            $scope.qrcode = response.data;
        });

Directive used

app.directive('avQr', function() {
    return {
        restrict: 'E',
        template: '',
        scope: {
                 image: '='
      },
      link: function(scope, elem, attr) {
            var qrImage = angular.element(scope.image);
            elem.append(qrImage);
      }
 }
})

In the html page tried with these to display got referenced from other suggestions and used it

<av-qr image="qrcode"></av-qr>
    <div ng-bind-html="qrcode"></div>
    <img data-ng-src='data:image/png;base64,{{qrcode}} />

But not working properly, from the rest controller i am sending the buffered image as response to the js controller.

Can anyone help to me solve this or any other suggestions.

0 Answers0