Working actually on form fields, I'm only using an outline appearance for my inputs (see more here).
Not wanting to copy appearance=outline
everywhere on each form, I wanted to know if there was a way to set the standard value of the appearance on outline.
I've found out in the API that there is a MAT_FORM_FIELD_DEFAULT_OPTIONS
(link). But I don't know how to use it and didn't found much documentation on it.
Or maybe should I just stick with a basic appearance="{{defaultAppearance}}"
on each form field and set a global variable, but I still have to duplicate this code everywhere (but it still allows me change the style easily whenever I want to)
Got the answer here.
add this:
{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' }}
in the providers of @ngModule.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With