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

175
Visualizações
"hidden" with brackets doesn't work in Angular

I add [hidden]="true" to an HTML element in Angular, but the element is still visible. I noticed that when I remove the [] from around hidden, the element is now hidden as desired. Why won't [hidden]="true" work with brackets? I see many references to it on stackoverflow and elsewhere but can't get it to work. Is this deprecated?

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

try this. hope it will help you.

<div [hidden]="'true'"><div/>

about 4 years ago · Juan Pablo Isaza Relatório

0

It should work like you explained. Otherwise something else is overwriting hidden. For example:

Some styles can overwrite hidden. Styles and classes may be inherited from somewhere?

<input [hidden]="true" style="display: block">

It would be possible to explicitly not allow that. This might be useful if you don't want to change conflicting classes rather just force this on.

[hidden] {
  display: none !important;
}

Alternative could be to use dispaly: none:

<input [style.display]="'none'">

This input is hidden but still in the DOM.

about 4 years ago · Juan Pablo Isaza Relatório

0

Thanks to everyone for your responses. I just realized this is because I'm trying to use this inside of index.html, which is outside of the Angular entry point.

about 4 years ago · Juan Pablo Isaza 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