I had a similar requirement and eventually implemented the behavior using a custom directive. look at: https://plnkr.co/edit/5fQkvG?p=preview
@Directive({ selector: '[clrDisable]' }) export class DisableDirective implements OnInit, OnChanges { @Input('clrDisable') disabled:boolean constructor(private elementRef:ElementRef) { } ngOnInit(){ } ngOnChanges() { let nativeRef = this.elementRef.nativeElement; if(this.disabled) { nativeRef.classList.add("clr_disabled"); } else { nativeRef.classList.remove("clr_disabled"); } } } .clr_disabled{ pointer-events:none; background-color:#ccc; opacity:0.5; }
source share