一尘不染

AngularJS-ng禁用不适用于Anchor标签

javascript

我正在使用ng-disabled,我喜欢它。输入和按钮对我来说很好。对于锚标签不起作用。我该如何解决?

HTML code

<a ng-disabled="addInviteesDisabled()">Add</a>

JS code

  $scope.addInviteesDisabled = function() {
      return $scope.event.status === APP_CONSTANTS.STATUSES.PENDING_APPROVAL;
  };

阅读 322

收藏
2020-05-01

共1个答案

一尘不染

没有超链接的禁用属性。你可以这样做:

.disabled {
  cursor: not-allowed;
}

<a ng-click="disabled()" ng-class="{disabled: addInviteesDisabled()}">Add</a>

$scope.disabled = function() {
  if($scope.addInviteesDisabled) { return false;}
}
2020-05-01