Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set default directive for all input in app

I use mat-form-field with custom css in order to change the be look like appearance="outline" directive.

In Angular Material v 7.2.1 appearance="outline" was added to the mat-form-field options.

How can I declare appearance="outline" as a default for each input fields in my app?

like image 699
Stack Overflow Avatar asked Jan 28 '19 08:01

Stack Overflow


1 Answers

you can try to inject mat-form-field default options in your @NgModule:

...
providers: [ 
   { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } } 
],
...

There was an issue with this https://github.com/angular/material2/issues/12765, but I believe it has been solved.

like image 115
Walter Luszczyk Avatar answered Oct 19 '22 01:10

Walter Luszczyk