Hi I’m Cristian,
I started using Ionic recently, is very powerful and easy to use.
I’m trying to use a button with type file for uploading an image but I have a problem with the action sheet on IOS.
This is part of the view:
<input type="file" id="upload-file" onchange="angular.element(this).scope().fileNameChanged()" />
<div class="row">
<button class="button" ng-click="uploadPhoto()" style="width:100%"> +
<i class="icon ion-camera"></i>
</button>
</div>
and this is part of the controller:
$scope.uploadPhoto = function(){
$('#upload-file').click()
}
$scope.fileNameChanged = function() {
var image = $('#upload-file')[0].files[0];
....some code
}
When I click on the button, I trigger an event ‘click’ on hidden file input.
After the click I see the action sheet, there are two possibilities: take a photo or choose from library.
When returning to the view of app, the next click on the screen show me the action sheet again. How it’s possible?
Can you help me?
Cristian