Hey there, I'm having trouble uploading an image and displaying it on my screen. Can anyone lend a hand? I was trying to use this example as a guide: http://jsfiddle.net/kkhxsgLu/2/
Check It Out!
<div class= "col-sm-6">
Upload an image:
<br><br>
<input id="file" type="file" accept="image/*" ng-model="file" ng-onchange="vm.imageUpload(this)"/>
<br>
<img ng-src="{{ file }}" />
</div>
Controller Details
var vm = this;
vm.file = {};
vm.imageUpload = function() {
var reader = new FileReader();
reader.onload = vm.imageIsLoaded;
reader.readAsDataURL(element.files[0]);
};
vm.imageIsLoaded = function(e) {
vm.$apply(function() {
vm.file = e.target.result;
})
}