jeudi 19 juillet 2018

Angular4 checkbook value bind and Post error

So ! I've got a get request ant first section where I get back some data from database. I would like to select with checkbox the original id (this is why I use checkbox value=original id). After that in comment section there is an input field for some data, and the last input field is the bind place where I would like to bind the checkd item value. It is working as well, but if I would like to post it to backend I got an error code "Error: Property 'originalid' doesn't exist. at query.replace.name" . Interesting that if I delete one character from the binded value it will be posted in normal way.

In my opinion it binding an extra value or something, but I can't see. I think there will be some problem in log = ''; or in the function log section.

HTML:

<label [class.selected]="cb1.checked">
                <input #cb1 type="checkbox" value="" (change)="logCheckbox(cb1)">  
              <b>ID:</b> <b> <b>MSG:</b>
              </label>

<mat-form-field>
            <input matInput placeholder="OriginalId" [(ngModel)]="noteText.originalid" autofocus #noteText value="">
          </mat-form-field>

<button mat-raised-button 
                  (click)="postImportantNote($event, noteText); ngOnInit()">Click me !</button>


        </div> 

TS:

log ='';   

logCheckbox(element: HTMLInputElement): void {
      this.log +=`${element.value}`;
    }




Aucun commentaire:

Enregistrer un commentaire