Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

425
Views
Is it possible to use multiple ::ng-deep identifiers to apply a style on a deeply nested component?

Say I have a DOM tree like so:

  <component1>
    <component2>
      <div>
        <component3>
          <div>
            <div>
              <div>
                <div>
                  <component4> Can a style be applied here using ng-deep?</component4>
                </div>
              </div>
            </div>
          </div>
        </component3>
      </div>
    </component2>
  </component1>

Is it possible to apply a style from a parent component (component1) on to the deeply nested 'component4'. Assuming all components are encapsulated..

Edit: I'm very aware this is not ideal in many ways, but question stands?!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Yes, it is.

Basically, using ng-deep will break the shadow DOM, which will apply the css to every component being into it.

Meaning the following code added inside the component1.scss will change the background color of the <component4>

:host &::ng-deep component4 {
    background-color: blue;
}

As you said this is not ideal in many ways and I cannot recommend you to use ::ng-deep since this is deprecated, please do use encapsulation instead

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!