为什么[attr.disabled]="true"
无法在锚标记中工作?
this.isHold=true;
<a (click)="showDialogToHold()" href="Javascript:void(0);" class="a-l2-link
img-space" icon="fa-angle-right" [attr.disabled]="isHold">Hold</a>
我也试过[disabled]="isHold"
。但[disabled]
不支持锚标记。它会抛出与Can't bind to 'disabled' since it isn't a known property of 'li'
Can't bind to 'disabled' since it isn't a known property of 'a'
答案 0 :(得分:0)
html中的超链接没有禁用属性。参考https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a。因此,您可以使用css来实现此目的。
CSS代码:
text-decoration:none;
cursor:default;
color:grey;
poniter-events:none;
答案 1 :(得分:0)
尝试:
package Q44240531_TestNG_Main;
import org.testng.annotations.Test;
public class TESTClass extends TESTTNGClass {
@Test
public void f()
{
System.out.println("In Test");
}
}
答案 2 :(得分:0)
.disabled {
pointer-events: none !important;
cursor: default;
}
<a (click)="showDialogToHold()" href="Javascript:void(0);" class="a-l2-link
img-space" icon="fa-angle-right" [ngStyle]="{ 'disabled ': isHold }">Hold</a>