我正在使用ng-disabled,我喜欢它。输入和按钮对我来说很好。对于锚标签不起作用。我该如何解决?
HTML code
<a ng-disabled="addInviteesDisabled()">Add</a>
JS code
$scope.addInviteesDisabled = function() { return $scope.event.status === APP_CONSTANTS.STATUSES.PENDING_APPROVAL; };
没有超链接的禁用属性。你可以这样做:
.disabled { cursor: not-allowed; } <a ng-click="disabled()" ng-class="{disabled: addInviteesDisabled()}">Add</a> $scope.disabled = function() { if($scope.addInviteesDisabled) { return false;} }