How do I draw image into a Canvas with ng-src


#1

The image I’m trying to draw into the canvas is from my camera using the cordova camera plugin.

I’ve done it this way but I can’t seem to draw image into canvas. If the image is from local image (img/default_subject.png), it works just fine. Does anyone have an idea how to solve this? Thank you!

js:

var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var image = document.getElementById('source');

ctx.drawImage(image, 0,0);

index.html

<canvas id="canvas"></canvas>
<div style="display:none;">
  <img id="source" ng-src="{{imgURI}}"
       width="300" height="227">
</div>