jeudi 29 avril 2021

Checkbox in angular without ngmodel? what to replace with?

I have a checkbox that I need to enhance, previous it handled a call to the backend but now this is no longer needed, and is only required to be a checkbox that turns off other checkboxes if selected:

    <label class="custom-control custom-checkbox" style="display: block">
      <input type="checkbox" class="custom-control-input" id="myCheckbox" name="myCheckbox"
             [(ngModel)]="checkboxPolicy" (ngModelChange)="parentcheckbox($event,child1,child2,child3)">
      <span class="custom-control-indicator"></span>
      <span class="custom-control-description">
        <span id="checkboxstart">
        </span>
      </span>
    </label>

I need to remove the ngModel altogther, but the input requires it, is there away I can have a data-less checkbox that exists purely for UI purposes. Doesnt control any data, just controls the other boxes in the ngModelChange method.




Aucun commentaire:

Enregistrer un commentaire