猿问

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

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


HTML code


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

JS code


  $scope.addInviteesDisabled = function() {

      return $scope.event.status === APP_CONSTANTS.STATUSES.PENDING_APPROVAL;

  };


蝴蝶不菲
浏览 772回答 3
3回答

慕慕森

没有超链接的禁用属性。你可以这样做:.disabled {&nbsp; cursor: not-allowed;}<a ng-click="disabled()" ng-class="{disabled: addInviteesDisabled()}">Add</a>$scope.disabled = function() {&nbsp; if($scope.addInviteesDisabled) { return false;}}

回首忆惘然

您可以创建一个linkDisabledCSS类,并将其应用于锚点:<style>.linkDisabled {&nbsp; cursor: not-allowed;&nbsp; pointer-events: none;&nbsp; color: grey;}</style>
随时随地看视频慕课网APP
我要回答