ng2-validation-manager icon indicating copy to clipboard operation
ng2-validation-manager copied to clipboard

Cannot set array as value

Open jagadeshanh opened this issue 8 years ago • 3 comments

I am trying to set array values to a field, but its always passed as a string instead of an array.

    this.form.setValue({
      'request_types': ['hotel', 'flights']
    });

jagadeshanh avatar Dec 06 '17 11:12 jagadeshanh

@jagadeshanh In your case request_types is formArray right? If so, the issue known, is because currently setValue accepts only string not array or objects, can you submit PR for this?

sabrio avatar Dec 06 '17 11:12 sabrio

What was the reason for converting the value to string

this.formGroup.get(values).setValue(value.toString());

jagadeshanh avatar Dec 06 '17 12:12 jagadeshanh

I know there was an issue and I solved it with toString() but I don't remember what was the issue! However, change if you can make it work properly.

sabrio avatar Dec 06 '17 13:12 sabrio