为应用程序中的所有输入设置默认指令 [英] Set default directive for all input in app
问题描述
我将mat-form-field
与自定义css一起使用,以更改外观像appearance="outline"
指令.
I use mat-form-field
with custom css in order to change the be look like appearance="outline"
directive.
在Angular Material v 7.2.1
中将appearance="outline"
添加到了mat-form-field
选项中.
In Angular Material v 7.2.1
appearance="outline"
was added to the mat-form-field
options.
如何为应用程序中的每个输入字段声明appearance="outline"
作为默认值?
How can I declare appearance="outline"
as a default for each input fields in my app?
推荐答案
您可以尝试在@NgModule
中注入mat-form-field默认选项:
you can try to inject mat-form-field default options in your @NgModule
:
...
providers: [
{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }
],
...
此 https://github.com/angular/material2/issues/12765 ,但我相信已经解决了.
There was an issue with this https://github.com/angular/material2/issues/12765, but I believe it has been solved.
这篇关于为应用程序中的所有输入设置默认指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!