samedi 2 décembre 2017

Can't pass Checkbox value to the post method in Angular

I am trying to pass true or false to my component so I can post in database. But I get "On" instead true in debugger and I get Bad Request error because of isCompleted.value.

<div>
    <input type="checkbox" id="isCompleted" #isCompleted/>
</div>

<button (click)="add(Name.value, Description.value, isCompleted.value)">Add Job</button>

My component.ts

add(Name: string, Description: string, isCompleted: boolean): void {
    this.jobsServices.addJob({ Name, Description, isCompleted } as Jobs)
        .subscribe(jobs => {
            this.jobs.push(jobs);
        });
}

I already searched a lot and I am kinda stuck, I am new to Angular so don't be hard on me please. Any help appreciated




Aucun commentaire:

Enregistrer un commentaire