Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 角度Css未从角度组件Css执行_Html_Css_Angular_Typescript_Angular9 - Fatal编程技术网

Html 角度Css未从角度组件Css执行

Html 角度Css未从角度组件Css执行,html,css,angular,typescript,angular9,Html,Css,Angular,Typescript,Angular9,我的angular project正在从包含以下代码的库中读取:代码是一个类: class MyClass extends EventEmitter { constructor () { // add the element to the container this.loadingElement = document.createElement('div'); this.loadingElement.className = "loading"

我的angular project正在从包含以下代码的库中读取:代码是一个类:

class MyClass extends EventEmitter {

    constructor () {

      // add the element to the container
      this.loadingElement = document.createElement('div');
      this.loadingElement.className = "loading"
      this.loadingElement.innerText = 'Now Loading...';
    }

}
在我的app.component.css中,我有以下内容:

  #componentDivId .loading {
    position: absolute;
    top: 50%;
    left: 50%;
  }
此css位于app.component.css中


如何更改它以使其读取css?

您应该查看
:ng deep
以覆盖组件样式。此外,可能需要使用
!必要时在
css
文件中输入重要信息


如何使用
::ng deep
将样式推送到子组件。

或者,通过创建加载程序组件并在需要时注入它,以正确的方式执行此操作。直接将DOM更新到angular是一种反模式