I am working with the following directive:
@Directive({
selector: "[myDir]"
})
export class MyDir implements OnInit {
private el:HTMLElement
@Input() hide: boolean
constructor(el: ElementRef) {
this.el = el.nativeElement
}
ngInit() {
console.log(typeof this.hide) // Outputs string in the console
}
}
Template :
<p myDirnumber=1 hide=false></p>
Is there a way to ensure that hide accepts only boolean type values?