AngularJS - NG-残疾不能工作锚标签 [英] AngularJS - ng-disabled not working for Anchor tag

查看:83
本文介绍了AngularJS - NG-残疾不能工作锚标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的NG-残疾人,我喜欢它。它的工作对我好输入和按钮。对于定位标记不工作。我该如何解决?

HTML code

 <一个NG-禁用=addInviteesDisabled()>添加< / A>

JS code

  $ scope.addInviteesDisabled =功能(){
      返回$ scope.event.status === APP_CONSTANTS.STATUSES.PENDING_APPROVAL;
  };


解决方案

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

  .disabled {
  光标:不是不允许的;
}<一个NG点击=已禁用()NG-CLASS ={禁用:addInviteesDisabled()}>添加< / A>$ scope.disabled =功能(){
  如果($ scope.addInviteesDisabled){返回false;}
}

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 code

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

JS code

  $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-残疾不能工作锚标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆