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

217
Visualizações
Angular2 one radio button not disabled

I have a series of radio buttons on a page that are grouped into a collection of "yes"/No" buttons. I want to disable them based on the value of a variable but only the "Yes" button gets disabled when I go to the page. I also have a drop down that changes the variables the ngModel is looking at (the "selectedIndex" variable in the code below) and if I use that drop down to select a different value and then reselect the original value both buttons are disabled. I know the code for the [disabled] is working since it works on the "Yes" button, just not the "No" button. Any ideas?

<div class="col-sm-2">
  <input type="radio"
        name="NewSites"
        id="newsitesyes"
        required="required"
        [value]="true"
     [(ngModel)]="quarterlyInfo[selectedIndex].NewSitesOrSitesNoLongerParticipating"
        [disabled]="quarterlyInfo[selectedIndex].StudyDataLocked" />
  <label for="newsitesno">Yes</label>
  <input type="radio"
        name="NewSites"
        id="newsitesyes"
        required="required"
        [value]="false"
 [(ngModel)]="quarterlyInfo[selectedIndex].NewSitesOrSitesNoLongerParticipating"
        [disabled]="quarterlyInfo[selectedIndex].StudyDataLocked" />
  <label for="newsitesno">No</label>
</div>
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The same id (id="newsitesyes") for both inputs might be the problem.

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