1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Having an issue while trying to pass my FormBuilder[] data to SQL table

Discussão em 'Angular' iniciado por Onurcan Kalender, Maio 30, 2025.

  1. Ths is my Save method:

    Save() {
    const formData = this.form.getRawValue();

    if (this.form.invalid) {
    this.toastr.warning('Lütfen formu eksiksiz doldurunuz.');
    return;
    }

    this.isLoadingSave = true;
    this.service.Add(formData).subscribe((response) => {
    this.isLoadingSave = false;
    this.toastr.success('Kayıt Başarılı.');
    this.form.reset();
    this.rows.clear();
    }, (err) => {
    this.isLoadingSave = false;
    this.toastr.error(GetErrorMessage(err), 'Hata', {
    enableHtml: true,
    closeButton: true
    });
    });
    }


    and this is my model for the module I have generated:

    export interface Dnmk_ScoreBoardTaskTypeDefinition {

    taskTypeId: number;
    definitionId: number;
    score: number;
    itemId: number;
    scale : number;
    item?:Dnmk_ScoreBoardItems;
    }


    When I am trying to create the form and save it to the SQL table, I get this error:


    Argument of type '{ taskTypeId: any; definitionId: any; score: any; scale: any; itemId: any; }' is not assignable to parameter of type 'Dnmk_ScoreBoardTaskTypeDefinition'. Property 'item' is missing in type '{ taskTypeId: any; definitionId: any; score: any; scale: any; itemId: any; }' but required in type 'Dnmk_ScoreBoardTaskTypeDefinition'.ts(2345) Dnmk_ScoreBoardTaskTypeDefinition.model.ts(10, 5): 'item' is declared here.
    ​

    The FormArray I create using different table data which is why I have declared all the necessary fields in my SQL table they are like

    Id TaskTypeId DefinitionId Score
    CreateUserId CreateDate UpdateUserId UpdateDate Scale ItemId


    I have tried to use item as optional in my model but it is still not working. What am I missing?

    Continue reading...

Compartilhe esta Página