Angular Material:如何设置背景色(不带CSS) [英] Angular Material: how to set background-color (without CSS)
问题描述
我正在使用Angular Material框架开发一个纯Material Design应用程序.
I'm developing a pure Material Design application using Angular Material framework.
但是,我不明白如何设置容器的背景颜色(例如,蓝色背景的登录表单). 我当然可以使用CSS来做到这一点,但我想知道是否有内置的指令/主题选项可以做到这一点.
However, I don't understand how to set containers' background colors (e.g. a login form with a blue background). I could do it using CSS of course but I wonder if there's a built-in directive / theme option to do this.
推荐答案
我很确定我已经在文档中的某个地方看到了这个,但是现在找不到了.您必须做两件事:
I am pretty sure I have seen this somewhere in the docs, but I cant find it now. You have to do two different things:
- 设置
.backgroundPalette('indigo')
的方式与设置主主题的方式相同 - 创建容器
- set
.backgroundPalette('indigo')
same way as you set primary theme - create container
我已经在0.8.1版本的角材料上对其进行了检查,并且可以正常工作.
I have check it on 0.8.1 version of angular-material and it works ok.
如果您还有其他问题,请随时提问.
Feel free to ask, if you have any additional questions.
例如:
app.config(function ($mdThemingProvider) {
$mdThemingProvider
.theme('default')
.primaryPalette('indigo')
.accentPalette('pink')
.warnPalette('red')
.backgroundPalette('blue-grey');
});
并在您的模板中:
<md-content>
<p>Some text</p>
</md-content>
这篇关于Angular Material:如何设置背景色(不带CSS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!