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

211
Visualizações
Why does angular checkbox gets toggled even if I provide value as false?

In react

<input type='checkbox' checked={true} />

makes the checkbox non toggleable.

However the same in angular makes it toggleable?

<input type='checkbox' [checked]=true />

My use case is multi select dropdown with an max selection value in it. So if the selection is maxed I shouldn't let the user select an option.

Currently I've made it using disabled option something like this.

<input type="checkbox" [name]="option.label" [checked]="option.isSelected"
               [disabled]="!option.isSelected && max === selected.length"
               (change)="toggleSelectedItem(option.id)">

But I would like to know the reason behind such behaviour in angular? By such behaviour I mean in react if the checked attribute is set to true it doesn't allow user to check or uncheck the item which is what is expected. Why isn't it the case with angular?

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