I need help converting this code to be compatible with angular.js so that I can retrieve the data URL and send it using $http.post
<input type="file" id="imgfiles" name="imgfiles" accept="image/jpeg" onchange="readURL(this);">
function readURL(input) {
if (input.files[0].size <= 1048576) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#cam_photo').attr('src', e.target.result).width(250).height(230);
var a = $('#cam_photo').attr('src');
data_url = a;
};
reader.readAsDataURL(input.files[0]);
}
} else {
alert('File is too large. Upload file less than 1MB');
}
}