hide/delete underline input
See original GitHub issueBug
Property 'underlineRef' does not exist on type 'MdInputDirective'
However, underlineRef property exists if we log this MdInputDirective:
Expected behavior
@ViewChild('input') input: MdInputDirective;
ngOnInit(): void {
this.input.underlineRef.nativeElement.className = null; // Removes the input underline
}
What is the current behavior?
Compilation error
What are the steps to reproduce?
Link of a discussion on the issue: https://stackoverflow.com/questions/45556972/how-to-hide-delete-underline-input-angular-material
Is there anything else we should know?
Workaround
@ViewChild('input') input: MdInputDirective;
ngOnInit(): void {
this.input['underlineRef'].nativeElement.className = null; // Remove the input underline
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to hide/delete underline input Angular Material?
In compoent do following: @ViewChild('input') input: MdInputDirective; ngOnInit(){ this.input.underlineRef.nativeElement.className = null; }.
Read more >How To Hide/Delete Underline Input Angular Material - ADocLib
The way to remove underlines from your links is to Select your link (or if you have text inside a Button Block, an...
Read more >How to remove underline for anchors tag using CSS?
Example 2: Use hover property to remove underline when mouse move over the anchor part.
Read more >How to Remove and Style the Border Around Text Input Boxes ...
Use outline: none to remove the ugly border color for a form field in Chrome. Learn also how to give your own style...
Read more >How to hide/delete underline input Angular Material - iTecNote
When input has focus it displays underline. How to hide or remove that? Seem I need to set null for underlineRef ?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Personally I’d opt for using css and leaving the
underlineRef
alone. I think the only reason it is exposed is for the datepicker to have a reference element to attach to, and I could easily see it going away or becoming internal-use-only.I’d suggest a slight variation of your plunk:
https://plnkr.co/edit/S8vHnOuzr6l6tYiMOnmi?p=preview
By adding it to a global stylesheet, you can keep view encapsulation on for your component.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.