I've got a button that I can enable/disable via a binding:
<button [disabled]="model.disabled">Do Something</button>
I've got some styling that's dependent on that attribute, for example:
button[disabled] {
background: red;
}
So far so good.
Now I attach a directive to that button which uses the disabled attribute an input:
@Directive({
selector: "[some-directive]"
})
class SomeDirective {
@Input("disabled") disabled: boolean;
}
If I attach this directive to a node:
<button some-directive [disabled]="model.disabled">Do Something</button>
This strips the disabled
attribute from the DOM, which breaks my styling.
Why is it doing this? Can I stop it from doing this?
disabled
attribute. I also have atooltip
directive, which displays a custom tooltip. If the node that's attached to gets disabled, I need to know about it so I can dismiss the tooltip. So I make thedisabled
attribute an input. There should be no name collision. It's an input, not an output. I should be able to have 100 directives that watch that input and act on it if I wish. – Mud