jeudi 13 février 2020

angular checkbox check event to send only selected id but it sending all

i want that when checkbox checked so selected ids should be posted with onsubmit function with add form value also don't know how to get checkbox event function inside onsubmit function

onSubmit(item, event) {

this.admin.createService(this.addForm.value)
  .subscribe( data => {
    console.log(data);

    this.val = data["data"]["service"]["sub_services"]

    console.log(this.val)



       for (var i = 0; i < this.value.length; i++) {            
        if (this.value[i].id) {
            this.val[i]= this.value[i].id

        }


    }   
       console.log(this.val)

  });

}




Aucun commentaire:

Enregistrer un commentaire