angularjs - ngDisabled alternative for link? -


i have list on page delete button each element. button not <button>, fontawesome icon ng-click pointing @ method of restful service:

<i class="fa fa-trash fa-lg pull-right" ng-click="deletequestion($id)"</i> 

the element removed view when http request completed. if user presses icon fast multiple times, duplicate requests sent , first successful, others fail, because entity not exist. want disable button (icon) or not send duplicate requests. best approach?

i know there ngdisabled, can not use it, cause element not button, , want block 1 button. not @ same time.

you can -

$scope.deletequestion(id) {     $scope.disabled = true;     $http.get('url')     .success(data){         //other logic         $scope.removed = true;     } } 

and in markup can have -

<i class="fa fa-trash fa-lg pull-right" ng-show="!removed" ng-disabled="deleted" ng-click="deletequestion($id)"</i> 

this simplest way not elegant.


Comments