I use angular 4 how can I disable the <a>
element with a condition doing something like this [disabled]="!f.form.valid"
<a class="btn btn-primary btn-lg disabled"
href="https://mailtrap.io/inboxes/354346/messages"
target="_blank" (click)=f.form.reset() > Verify your Email Now</a>
If you suggest to just use the link button so I want to konw how to add target="_blank"
答案 0 :(得分:0)
将样式归功于this excellent post in css-tricks。
.isDisabled {
color: currentColor;
cursor: not-allowed;
pointer-events: none
opacity: 0.5;
text-decoration: none;
}
<a [ngClass]="{'isDisabled':condition}"
class="btn btn-primary btn-lg disabled"
href="https://mailtrap.io/inboxes/354346/messages"
target="_blank" (click)=f.form.reset() > Verify your Email Now</a>