Angular Css not being executed from angular component css

Viewed 28

My angular project is reading from a library that contains this code is a class:

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...';
    }

}

In my app.component.css I have this:

  #componentDivId .loading {
    position: absolute;
    top: 50%;
    left: 50%;
  }

This css is in app.component.css

How can I change this so it reads the css?

1 Answers

You should look into ::ng-deep for overriding component styling. Also, may need to use !important in css file as and when required

Here is a demo code to help you understand how ::ng-deep can be used to push styling to a child component.

Related