为什么第3次点击后按钮事件停止?

时间:2019-06-27 15:56:24

标签: angularjs

我有这个网站: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 :(得分:0)

点击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 );