AngularJS - using ngTouch redirection with ngRoute doesn't work with href and ng-click attribute

前端 未结 1 1705
孤街浪徒
孤街浪徒 2021-01-21 19:08

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

Link

Since I

1条回答
  •  天涯浪人
    2021-01-21 19:31

    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:

    Link
    

    In controller:

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

    0 讨论(0)
提交回复
热议问题