Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49170

I can´t trigger a input type file in Device

$
0
0

@edavila wrote:

Hi. I have maybe one week with this problem.

When I use a input[type="file"] field in my form, in Ionic Lab it works fine. In Android emulator, it works fine. But, when I run the app in my phone, and I click/tap in the field, nothing happens. The button is pressed, but the filepicker dialog doesn´t show.

My input looks like it:

<input class="" id="image" type="file" name="image" ng-model="data.image" file="file"onchange="angular.element(this).scope().fileNameChanged(this.files)" style="display:none;" />

I tried something different, adding a button that trigger the click event in JS:

<button type="button" class="button icon ion-filing" ng-click="openFileDialog()">Select</button>

The method openFileDialog() does only this:

   $scope.openFileDialog = function() {
      alert('Test Open File DIalog');
      ionic.trigger('click', { target: document.getElementById('image')});
    };

The alert is shows when I click the button, but the event is not triggered. Again, it workd fin in Ionic Lab and the Emulator, but not in my device. I tried and test this project too:

https://github.com/krystiangw/filepicker-ionic-example

But the result was the same.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49170

Trending Articles