本文介绍了AngularJS - ng-disabled 不适用于 Anchor 标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using ng-disabled, I like it. It's working good for me for input and buttons. For anchor tag not working. How can I fix?

HTML 代码

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

JS 代码

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

推荐答案

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

There is no disabled attribute for hyperlinks.You can do this:

.disabled {
  cursor: not-allowed;
}

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

$scope.disabled = function() {
  if($scope.addInviteesDisabled) { return false;}
}

这篇关于AngularJS - ng-disabled 不适用于 Anchor 标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 04:57
查看更多