角度材质2输入样式(单个元素/页面)

时间:2017-04-02 16:02:12

标签: angular angular-material2

是否可以更改单个Input元素的样式(文本颜色,占位符颜色,下划线颜色等)?我可以根据全局样式设置剩余样式,但是如果要在单个页面或单个控件上专门设置主题,该怎么办?这是什么最好的做法?

例如,如何设置此块的样式以使占位符,文本和重点颜色都是自定义的?

<md-input-container>
  <input mdInput placeholder="Email address">
</md-input-container>

1 个答案:

答案 0 :(得分:0)

您可以为每个材质组件定义自定义主题,并且您应该能够覆盖相关组件的基本主题,如下所示:

Dumpcap can be installed in a way that allows members of the "wireshark" system
group to capture packets. This is recommended over the alternative of running
Wireshark/Tshark directly as root, because less of the code will run with
elevated privileges.

For more detailed information please see
/usr/share/doc/wireshark-common/README.Debian.

Enabling this feature may be a security risk, so it is disabled by default. If
in doubt, it is suggested to leave it disabled.

Should non-superusers be able to capture packets? [yes/no] yes

然后将该类添加到@import '~/@angular/material/input/input-theme' .custom-input { @include mat-input-theme($custom-input-theme) }

另外,如果要在组件的样式表中定义自定义类,请确保将封装设置为none:

<md-input-container>