How to pass array with multiple objects to Angular FormControl?

Discussão em 'Angular' iniciado por dozobus, Outubro 18, 2024.

  1. dozobus

    dozobus Guest

    Let's say I have an object with string values like this:

    data = { input: '', description: '' }


    where input is what user typed, that I grabbed in (change) function and description is what I have programmatically added in the function afterwards.

    I'm passing that array of data objects to formControl with this.form.patchValue({control: this.array}) but when I check against it with this.form.get('control').value it returns an array with only first object (array[0]).

    How do I get it to return entire array ?

    Continue reading...

Compartilhe esta Página