Event on-touch not working on Android 4.4.2


#1

Hi, is there solution for on-touch event that is not working on Android 4.4.2? Should I use ng-click or something else? Thanks


#2

Not working how? Can we see a working example?

Read this forum post:

http://forum.ionicframework.com/t/help-us-help-you/28875/3


#3

Sorry, I made a mistake. Actually, on-touch event is working. What doesn’t work is ionicModal. It is not showing.

  button class="button button-clear" on-touch="**openModalAddAlbum()**"
*// load add album view*
  $ionicModal.fromTemplateUrl('../../templates/modal/addAlbum.html', {
    scope: $scope,
    animation: 'slide-in-up'
  }).then(function(modal) {
    $scope.modalAddAlbum = modal;
  });

*// show add album view*
$scope.**openModalAddAlbum** = function() {
   $scope.modalAddAlbum.show();
  };

#4

Have you received any error?


#5

No, this is working in Chrome, but on mobile nothing happens. Same for ionic popover.


#6

Ok, have you tried to debug it using Chrome Remote feature.

You need to connect your device to your computer.

Open Chrome -> Options -> More Tools -> Inspect devices


#7

Error is:

Failed to load resource file:///templates/popover/input_popover.html
Under tab Sources in folder www there is no folder templates where I put views.

For that reason the path is not good and resource is not found.


#8

There you have it, you will need to change templates folder.

You should probably move them to www folder. Remember, Cordova directory structure is different than classic PC dir structure. www folder is the safest place


#9

The solution

before:

$ionicModal.fromTemplateUrl(**'../../templates/modal/addAlbum.html'**, {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modalAddAlbum = modal;
});

after:

$ionicModal.fromTemplateUrl(**'file:///android_asset/www/templates/modal/addAlbum.html'**, {
    scope: $scope,
    animation: 'slide-in-up'
  }).then(function(modal) {
    $scope.modalAddAlbum = modal;
  });

#10

Close, you could jsut do this too.

$ionicModal.fromTemplateUrl('templates/modal/addAlbum.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modalAddAlbum = modal;
});

Remember, keep all your paths relative to index.html