I've encountered a challenge with disabling an href link using Angular and Typescript, and I'm unsure if my current approach is the right one.
Is there a more optimal way to achieve something like this? I would like it to resemble the red circle in the image below:
https://i.sstatic.net/iWep2.png
typescript
ReadOnlyStyleGuideNotes: boolean;
ngOnInit() {
this.ReadOnlyStyleGuideNotes = true;
}
HTML
<a href="#"
*ngIf="note.Edited || note.Removed"
(click)="restoreDefault(note)"
style="font-size: 12px"
data-disabled="readOnlyStyleGuideNotes">
restore defaults
</a>
CSS class
a[data-disabled=true] {
color: currentColor;
cursor: not-allowed;
opacity: 0.5;
text-decoration: none;
}