2017-10-12 13 views
1

私が作成した共有機能それが仕事になりますが、AngularJSのアンカータグを複数回クリックするのを防ぐにはどうすればいいですか?

//HERE WE CREATE THE CONTOLLER FOR SHARING 
 
$scope.selectedSharedBuyerKeyList  = []; 
 
$scope.selectedSharedBuyerObjectList = []; 
 
$scope.productObjectForShareModal  = []; 
 

 
$scope.getConnectedSharedUser   = function(product) { 
 
$scope.productObjectForShareModal = product; 
 
var data = { 
 
    productKeyId : $scope.productObjectForShareModal.keyId 
 
} 
 

 
//Call the getSharedUserList function for get the detail of the shared connectedUsers 
 
SellerDashboardService.getSharedUserList(function(response) { \t \t \t \t 
 
    if(response != null) { 
 
     if (response.data.isProduct) { 
 
     $scope.selectedSharedBuyerKeyList = response.data.sellerProductsDto; 
 

 
     // Obtaining user object.. 
 
     $scope.selectedSharedBuyerObjectList = []; 
 
     for(var selectedSharedBuyerKey of $scope.selectedSharedBuyerKeyList) { 
 
      var data = selectedSharedBuyerKey; 
 
      //call the getBuyerInShared for get the list of the objects 
 
      SellerDashboardService.getBuyerInShared(function(response) { 
 
      if(response != null) { 
 
       if (response.data.isbuyer) { 
 
       var buyerObject = response.data.isbuyer; 
 
       $scope.selectedSharedBuyerObjectList.push(buyerObject); 
 
       } 
 
      } 
 
      },data); 
 
     } 
 
     } 
 
    } 
 
},data); 
 
}
<a href="#" class="fa fa fa-group btn btn-xs pull-left bg-color-d4" 
 
    data-toggle="modal" data-target="#groupModal" 
 
    ng-click="getConnectedSharedUser(productDBList)"> 
 
</a>

リストはどのように教えて何again.so繰り返されたタグとユーザーリストの複数のタイムクリック後に繰り返されます反復の問題を解決しますか?

+0

最初のクリック後にボタンを無効にします –

+0

私はパネルを使用していません。どのようにボタンを無効にするのですか? –

+0

下の私の答えを試してください、それはまたパネルのために動作するはずです –

答えて

1

私は角2でやった何この

$scope.selectedSharedBuyerObjectList = []; 
$scope.productObjectForShareModal  = []; 

$scope.cliked=false ///set click to false 



$scope.getConnectedSharedUser   = function(product) { 
$scope.productObjectForShareModal = product; 
var data = { 
    productKeyId : $scope.productObjectForShareModal.keyId 
} 

//Call the getSharedUserList function for get the detail of the shared connectedUsers 
SellerDashboardService.getSharedUserList(function(response) {    
$scope.clicked =true; ///set it back to true 
    if(response != null) { 
     if (response.data.isProduct) { 
     $scope.selectedSharedBuyerKeyList = response.data.sellerProductsDto; 

     // Obtaining user object.. 
     $scope.selectedSharedBuyerObjectList = []; 
     for(var selectedSharedBuyerKey of $scope.selectedSharedBuyerKeyList) { 
      var data = selectedSharedBuyerKey; 
      //call the getBuyerInShared for get the list of the objects 
      SellerDashboardService.getBuyerInShared(function(response) { 
      if(response != null) { 
       if (response.data.isbuyer) { 
       var buyerObject = response.data.isbuyer; 
       $scope.selectedSharedBuyerObjectList.push(buyerObject); 
       } 
      } 
      },data); 
     } 
     } 
    } 
},data); 
} 



<a href="#" class="fa fa fa-group btn btn-xs pull-left bg-color-d4" 
    data-toggle="modal" ng-disabled="cliked" data-target="#groupModal" 
    ng-click="getConnectedSharedUser(productDBList)"> 
</a> 
1

を試してみて、私は最初のクリックボタンを無効にしているです。

など。

<button (click)="someFunction()" [disabled]="disableButton"></button> 
someFunction() { 
     disableButton = true; 
} 

:構文は、あなたのケースで異なるだろうが、ロジックは同じになります。 これが役立つことを願っています。

関連する問題