Ng-click fires two times depending on how touch is forced!


#1

Hi,
I just have footer bar containing some buttons. In the device (android 4.4.2), I click on the button firing ChangeLanguage() routine, If i click quickly, the ChangeLanguage() will run twice. If i click slowly the ChangeLanguage() will run once. If i click more, the ChangeLanguage will not run. I think the last is normal. But running twice is not acceptable. I searched many articles about twice firing :

https://github.com/driftyco/ionic/issues/1022  
https://github.com/angular/material/issues/1406
https://github.com/driftyco/ionic/issues/2885

But none of them does not work. If i comment the $translate.use(‘en’), the click will work fine. It seems that if the process takes more than 300ms, this strange behaviour will be happened.

<body ng-app="MASCo" ng-controller="FooterCtrl">

<ion-footer-bar class="bar-stable main-footer compact">
    <div class="align-right">
        <ul class="details">
            <li><span class="time">16:23</span></li>
            <li><span class="icon icon-blueetooth active"></span></li>
            <li><span class="icon icon-connection"></span></li>
            <li><span class="divider"></span></li>
            <li><span class="text">Ver: 7.0</span></li>
            <li><span class="text">S/N: 26587694</span></li>
        </ul>
    </div>
    <div class="align-left">
        <ul class="navigation">
            <li><a class="button button-icon icon icon-back" ng-click="GoBack()"></a></li>
            <li><a class="button button-icon icon icon-home" ng-click="GoHome()"></a></li>
            <li><a class="button button-icon icon icon-camera" ng-click="doSomething()"></a></li>
            <li><a class="button button-icon icon icon-translate3" ng-click="ChangeLanguage()"></a></li>
            <li><a class="button button-icon icon icon-plug disconnected" ng-click="doSomething()"><i></i></a></li>
            <li><a class="button button-icon icon icon-sedan connected" ng-click="doSomething()"><i></i></a></li>
        </ul>

    </div>


</ion-footer-bar>

<ion-nav-view></ion-nav-view>
</body>

In the controller I have this routine :

.controller('FooterCtrl',
  function ($scope, $translate, $localstorage, $ionicHistory, $ionicSideMenuDelegate, $state, DoTrasnlateChange) {
    $scope.ChangeLanguage = function(lang){
      //var currentLang = $translate.proposedLanguage() || $translate.use();
      if($scope.TranslationValue == '0')
      {
        $scope.TranslationValue = '1';
        $translate.use('fa');  
        console.log("en");

      }
      else
      {
        $scope.TranslationValue = '0';
        $translate.use('en');
        console.log("fa");
      }
  })

#2

any suggest?
Can i run the Translate.use() in promise that the process would not be done in the ChangeLanuage() routine?


#3

Found the solution /:
just add : data-tap-disabled=“true”