I'm trying to create a reusable component. My expectation is that the value of masDisabled when not set to false or true will always be true. I still want the masDisabled construct like that, not [masDisabled]. But I have a problem, all components that do not have the masDisabled property are also disabled. How to solve it?
test.component.html
<mas-button masDisabled></mas-button>
button.component.html
<button type="button" class="btn btn-primary" [disabled]="disabledMas"></button>
button.component.ts
disabledMas = true;
@Input('disabledMas')
get masDisabled(): boolean {
return this.disabledMas;
}
set masDisabled(value: boolean) {
this.disabledMas = value === false;
}