一尘不染

AngularJS-禁用ng的Anchor标记无效

angularjs

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

HTML code

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

JS code

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

阅读 204

收藏
2020-07-04

共1个答案

一尘不染

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

.disabled {
  cursor: not-allowed;
}

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

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