0

I have made the following tries and I am able to fetch the Selected Checkbox Value but Unable to Fetch the Textbox Value that has been Entered. So i am in need of some suggestions.

HTML File

<ion-row class="service" *ngFor="let singleBarberService of allBarberServices">
 <ion-col col-7 padding>
      <ion-checkbox value="{{singleBarberService.service_id}}" (click)="clickSelectBox(singleBarberService)"></ion-checkbox> &nbsp;{{singleBarberService.service_name}} <br>
 </ion-col>
 <ion-col col-5>
      <ion-input type="number" placeholder="Amount" min="0" step="0.01" name="amountservice" #amountservice required></ion-input>  
 </ion-col>
</ion-row>

Note: allBarberServices Contains the JSON Array and it Displays the APP Page has the below screenshot.

enter image description here

TS File:

clickSelectBox(itemKey){
     const foundAt = this.selectedQuestions.indexOf(itemKey);
     if (foundAt >= 0) {
        this.selectedQuestions.splice(foundAt, 1);
     } else {
        this.selectedQuestions.push(itemKey);
    }
    console.log('Item Key: '+ itemKey.service_id);
    console.log(this.amountservice.value); // fetch only the First Textbox Value
    console.log(this.selectedQuestions); // This Displays all the Selected Checkbox Items 
  }
Naresh Kumar P
  • 4,127
  • 2
  • 16
  • 33
  • you haven't done any binding to your input: Check [here](https://stackoverflow.com/questions/43987674/ionic-2-get-ion-input-value) on how to bind your input value. – RamY Jul 19 '18 at 07:40
  • I have to use [(ngModel)] as per the Link that you have suggested right. Is there any way that i can add the service ID to the Text box Model Name... – Naresh Kumar P Jul 19 '18 at 07:42

0 Answers0