I am designing a Modal with boostrap and inside it I have a checkBox list that is loaded by running an NGFOR.
The problem is the following: At the time of selecting one of those elements all the checkboxes are selected, besides I do not have very clear how to receive in information of the checkbox selections in the component.ts
How can I choose only the values I want? And also send the information to my component?
This is my code:
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-6 col-lg-6 col-6" *ngFor="let data of sensor">
<input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="data.name" name= "miDataInterior" [(ngModel)]="miDataInterior">
<label class="form-check-label" for="inlineCheckbox1">{{data.name}}</label>
</div>
</div>
</div>
</div>
EDIT01
Hello,
The information I'm painting in the ngfor is the following:
["var_TempExt","var_HumRExt","var_HumRInt","var_Humedad_Sust1","var_Humedad_Sust2","var_PotActInv","var_PotActBio","var_ContadorRiego","var_RadiacionGlobalInt","var_RadiacionPARInt","var_CO2InvVaisala","var_TempInt","var_RadiacionExt","var_CO2Exterior","var_VVExt","var_DVExt","var_Lluvia","act_AbrirVentanaCen","act_AbrirVentanaLatNS","act_Aerotermo","act_BombaCalefaccion","act_Deshumificacion","act_Humidification","act_LuzArtificial","act_ValvulaTresVias"]
I need to be able to select any of those names and send that name in an array to my component and then pass them to the service.
In the ts I have a simple method to show me the information that the modal has, but I only recover a true
public guardar(){
console.log('formulario posteado: ' + this.checkbox);
}