问题描述
我使用带有自定义 css 的 mat-form-field
来改变看起来像 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.
这篇关于为应用程序中的所有输入设置默认指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!