I wondering to resolve this issue about accessibility. I'm using Angular and I have to set [attr.aria-label] depending on the value of a number variable, I mean, if this variable is < 5 displays "is minimum of 5", if the value of that variable is more than 5, diplays "is more than 5 ". Is it possible set [attr.aria-label] using conditionals?
This is my dynamic [attr.aria-label]. I need to use string + variable + sting, to display the value of variable
[attr.aria-label]="['text', variable, 'other text']"
Yes, you can simply do something like
<div [attr.aria-label]="property < 5 ? 'someText' : 'Alternative Text'"></div>