Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

431
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda