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

169
Views
"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 answers
Answer question

0

try this. hope it will help you.

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

about 4 years ago · Juan Pablo Isaza Report

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 Report

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 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!