Почему события кнопок останавливаются после 3-го нажатия? - PullRequest
0 голосов
/ 27 июня 2019

У меня есть этот сайт: http://www.panelatlantik.com/foodx/index.html

Например, найдите номер 133 и нажмите.

Вы увидите новую красочную кнопку справа. Нажмите и подождите 2 сек. Я изменю. Нажмите еще раз, подождите 2 сек. Это снова изменится. Большой! Но следующие клики не работают. Что я делаю не так?

 <tr>
    <td colspan="2" ng-if="pin3.status=='Yeni'">
        <button ng-click="gYap(pin3.orderid)" style="width: 100%" class="btn btn-success">PREPARING</button>
    </td>
</tr>

<tr>
    <td colspan="2" ng-if="pin3.status=='Gönderildi'">
        <button ng-click="iYap(pin3.orderid)" style="width: 100%" class="btn btn-success">SENT</button>
    </td>
</tr>

<tr>
    <td colspan="2" ng-if="pin3.status=='İptal'">
        <button ng-click="gAl(pin3.orderid)" style="width: 100%" class="btn btn-info">CANCELLED</button>
    </td>
</tr>


    $scope.gYap = function(param){
        $http.get("php/makine.php?komut=gYap&id="+param).then(function(response) {
         $scope.gYap = response.data;}) 
         $timeout( function(){
            $scope.hepsi();
    }, 1000 );

    $timeout( function(){
        $scope.siparisgetir(param);
    }, 2000 );

         }

         $scope.iYap = function(param){
        $http.get("php/makine.php?komut=iYap&id="+param).then(function(response) {
         $scope.iYap = response.data;})  
         $timeout( function(){
            $scope.hepsi();
    }, 1000 );

    $timeout( function(){
        $scope.siparisgetir(param);
    }, 2000 ); }

         $scope.gAl = function(param){
        $http.get("php/makine.php?komut=gAl&id="+param).then(function(response) {
         $scope.gAl = response.data;})  
         $timeout( function(){
            $scope.hepsi();
    }, 1000 );

    $timeout( function(){
        $scope.siparisgetir(param);
    }, 2000 ); 
         }

1 Ответ

0 голосов
/ 02 июля 2019

После 3-го клика я получил

v2.gYap не является функцией

Так что я думаю, что проблема здесь:

$scope.gYap = function(param){ //<-- here gYap is definied as function
    $http.get("php/makine.php?komut=gYap&id="+param).then(function(response) {
     $scope.gYap = response.data;}) //<-- here gYap is redefinied and its no longer function
     $timeout( function(){
        $scope.hepsi();
}, 1000 );
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...