Event on-touch not working on Android 4.4.2

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

Not working how? Can we see a working example?

Read this forum post:

http://forum.ionicframework.com/t/help-us-help-you/28875/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();
  };

Have you received any error?

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

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

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.

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

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;
  });

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

2 Likes