Is it possible to bind a boolean variable to the existence of a attribute?
template: ...,
host: {
"[attr.disabled]": "disabled"
}
This is rendered in the element as disabled="true" or disabled="false". But I want to use it in css with the [disabled] selector, that if the variable is false, the attribute doesn't exist and if true it does exist. Thanks in advance.
For a boolean attribute to be removed the value needs to be null
not false
"[attr.disabled]": "disabled ? true : null"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With