Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

502
Visualizações
ngdeep in angular for a specific component or element

How do we use ng deep css class only specific to only for example 1 checkbox and not all checkboxes in my component

for example I only want to use this with my one checkbox and not all checkboxes in my component. how do we do that ? thanks.

I only want to apply it on a specific checkbox . cause in my component there is 5 different checkboxes but I only want to modify 1 checkbox , so the 4 should not be affected.

So for example there are 2 checkbox below , the CSS should only affect the first checkbox and not include the second one

#checkbox code

 <mat-checkbox
                  *ngIf="currentSelectedTenants(subtenant) else currentSubtenants"
                   color="accent"  
                   [(ngModel)]="dealDispositionFormFields.currentSubtenants"
                   [checked]="currentSelectedTenants(subtenant)" 
                   (change)="changeCurrentSubtenants($event,subtenant)"
                   style="margin-left:10px;">
                  <mat-label class="alter-text-color" style="font-size: 12px;">{{subtenant.subtenantName}}</mat-label>
                  </mat-checkbox>  


 <mat-checkbox
                  *ngIf="currentSelectedTenants(subtenant) else currentSubtenants"
                   color="accent"  
                   [(ngModel)]="dealDispositionFormFields.notCurrentSubtenant"
                   [checked]="currentSelectedTenants(subtenant)" 
                   (change)="changeCurrentSubtenants($event,subtenant)"
                   style="margin-left:10px;">
                  <mat-label class="alter-text-color" style="font-size: 12px;">{{subtenant.subtenantName}}</mat-label>
                  </mat-checkbox>  

#css

::ng-deep .mat-checkbox-checkmark-path {
    stroke:rgba(0, 125, 255, 1) !important;
  }
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You can add mat-checkbox inside a div and assign one class to it:

<div class="new-class">
  <mat-checkbox>
  </mat-checkbox>
</div>

And your css will look like this:

::ng-deep .new-class .mat-checkbox-checkmark-path {
    stroke:rgba(0, 125, 255, 1) !important;
 }

PS: You can name new-class as per your requirement

over 4 years ago · Santiago Trujillo Relatório

0

Use a css class in the mat-checkbox you want to customize:

<mat-checkbox class="custom-mat-checkbox">
...
</mat-checkbox>

And then customize it via CSS.

::ng-deep mat-checkbox.custom-mat-checkbox {
   // custom css goes here
}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda