2

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 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Or, do this the correct way by creating a loader component and injecting it when you need it. Direct DOM updates to angular are an anti-pattern

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.