I have a <input type=file>
and I want to add the path of the image to this input to send the form to my webservice. I can get the image path through a factory and I can not change the value of this input by adding the path.
How do I change the value of this input by the 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);
}
}
}]);