npm install ngx-boolean-input
import { BooleanInput } from 'ngx-boolean-input';
@Component({
selector: 'app-component',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
@Input()
@BooleanInput()
editable: boolean | string | undefined;
}
<app-component></app-component> <!-- false -->
<app-component editable></app-component> <!-- true -->
<app-component [editable]="false"></app-component> <!-- false -->
<app-component editable="false"></app-component> <!-- false -->
<app-component [editable]="true"></app-component> <!-- true -->
- Dominic Elm https://dev.to/angular/decorators-do-not-work-as-you-might-expect-3gmj
- michaeljota angular/angular#14761
This project was generated using Nx.