Html 如何更改最外层的背景色<;车身>;带角标签

Html 如何更改最外层的背景色<;车身>;带角标签,html,angular,typescript,Html,Angular,Typescript,我想以编程方式更改AngularApp的背景色。这里的问题是,更改应用程序内部的背景只适用于屏幕的某些部分。可能只有已经充满内容的内容。我希望整个网站改变颜色 我正在使用angular.io提供的种子。index.html如下所示: <!DOCTYPE html> <html> <head> <base href="/"> <title>Angular QuickStart</title&g

我想以编程方式更改AngularApp的背景色。这里的问题是,更改应用程序内部的背景只适用于屏幕的某些部分。可能只有已经充满内容的内容。我希望整个网站改变颜色

我正在使用angular.io提供的种子。index.html如下所示:

<!DOCTYPE html>
<html>
    <head>
        <base href="/">
        <title>Angular QuickStart</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="styles.css">
        <!-- Polyfill(s) for older browsers -->
        <script src="node_modules/core-js/client/shim.min.js"></script>
        <script src="node_modules/zone.js/dist/zone.js"></script>
        <script src="node_modules/systemjs/dist/system.src.js"></script>
        <script src="systemjs.config.js"></script>
        <script>
            System.import('app').catch(function (err) { console.error(err); });
        </script>
    </head>
  <body>
    <my-app>Loading AppComponent content here ...</my-app>
  </body>
</html>

角度快速启动
System.import('app').catch(函数(err){console.error(err);});
正在此处加载AppComponent内容。。。
有没有办法操纵AngularApp中最外层“身体”的类

我可以更改“我的应用程序”标签中的所有内容。有没有一种方法可以设置index.html,使第一个“body”标记在我的控件中

如果没有,是否有其他方法可以控制外部“body”标签

提前谢谢


BR Mathias

如果使用
'body'
(而不是
'my-app'
)作为选择器,则应用于主体元素的每个样式也将应用于
,因为它们是相同的

@Component({
  selector: 'body'
  styles: [':host { border: solid 10px red;}']
})
export class AppComponent {
  @HostBinding('style.background-color')
  backgroundColor:string = '#ffaacc';

}

在组件中有一种更简单的方法

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})
export class AppComponent {

    constructor() {
        document.body.style.background = 'rgba(0, 0, 0, .6)';
    }

}
或者在
src/styles.CSS中使用简单的CSS

body {
    background: whatever;
}