2
I have a <input type=file>
and I want to add the image path to this input to send the form to my webservice. I can pick up the image path through a Factory and cannot change the value of that input by adding the path.
How do I change the value of that input by Factory ?
input
<input type="file" ng-model='User.imageFile' id='imageFile'/>
Factory
var app = angular.module('starter');
app.factory('CameraFactory', ['$q', function($q) {
var options = {
quality: 50,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: 0, // 0:Photo Library, 1=Camera, 2=Saved Photo Album
}
var onSuccess = function(imageData) {
window.resolveLocalFileSystemURI(imageData, function(fileEntry) {
//console.log(fileEntry.nativeURL);
var imageFile = document.getElementById('imageFile');
imageFile.value = fileEntry.nativeURL;
});
var image = document.getElementById('smallimage');
image.src = imageData;
};
var onFail = function(e) {
console.log("onFail! " + e);
};
return {
getPicture: function() {
return navigator.camera.getPicture(onSuccess,onFail,options);
}
}
}]);
perfect, worked exactly as I wanted. thank you very much.
– FernandoPaiva