2

I navigate through the app with ngRoute. I use links like:

<a href="#/page2" ng-click="showOffCanvas = false">Link</a>

Since I use ngTouch the navigation doesn't work on touch devices. I tried it with an android phone and with chrome's device emulator. On the desktop everything works fine.

When I remove ngTouch this problem disappears. It also disappears when I remove the ng-click attribute.

Linking to:

<a href="www.google.com" ng-click="showOffCanvas = false">google</a>

is working on every device. It seems that only the routing with ngRoute stops to work, when I include ngTouch.

What would be the solution?

john89er
  • 53
  • 5

1 Answers1

2

It is an old bug, that wasn't fixed before this time. Href and ng-click doesn`t work together.

A workaround could be to use an empty href and put the navigation logic into ng-click using $location.

Proof: https://github.com/angular/angular.js/issues/5307#issuecomment-30024683

In HTML:

<a href="" ng-click="showOffCanvas = false; goTo('#/page2')">Link</a>

In controller:

$scope.goTo = function(refer){
    $location.path(refer)
};