How to hide/delete underline input Angular Material?

前端 未结 10 1123
伪装坚强ぢ
伪装坚强ぢ 2020-12-14 06:24

I have input element in Angular Material:




         


        
10条回答
  •  孤城傲影
    2020-12-14 07:00

    Update:

    Import MdInputDirective

    import {MdInputDirective} from '@angular/material';
    

    In compoent do following:

    @ViewChild('input') input: MdInputDirective;
    
    ngOnInit(){
      this.input.underlineRef.nativeElement.className = null;
    }
    

    In html, add the #input reference:

    
      
    
    

    Plunker demo

    Original:

    Try css:

    ::ng-deep .mat-input-underline {
        display: none;
    }
    

    demo

提交回复
热议问题