我正在使用 MEAN 堆栈。当我在某个 View 上时,我想知道是否可以更改页面上的背景颜色。例如,如果我单击转到联系人 View ,我希望该 View 的背景颜色更改为蓝色。我根据我的一个观点尝试了这个
<section ng-controller="HomeController" style="background-color #97D2D8;">
</section>
但它只改变了其他元素的颜色而不是页面。谢谢
最佳答案
您可以使用ngClass
或ng-style
ng 风格: 在你的 Controller 中声明一个变量
myStyle={background-color:'red'}; //You can change the color according to the active view
那么在你看来
<section ng-controller="HomeController" ng-style="myStyle">
</section>
关于html - 平均堆栈 : Change body background color on a certain view,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37636335/