Is it possible to toggle the underline for a matInput of a mat-form-field on and off using either CSS or backend Typescript?
I have seen something such as this question which shows it can be removed with css such as:
::ng-deep .mat-form-field-underline {
display: none;
}
But I am unsure whether this can be implemented within an [ngClass]
to toggle it?
The question also shows that it can be done programatically, however I am unaware of if this is reversible, and also I am using material design with the prefix mat
rather than md
...
@ViewChild('input') input: MdInputDirective;
ngOnInit(){
this.input.underlineRef.nativeElement.className = null;
}
Here is my blitz