sabrio / ng2-validation-manager

Validation manager library for Angular 2 (based on Laravel Validation method)
34 stars 14 forks source link

Cannot set array as value #11

Open jagadeshanh opened 6 years ago

jagadeshanh commented 6 years ago

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']
    });
sabrio commented 6 years ago

@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?

jagadeshanh commented 6 years ago

What was the reason for converting the value to string

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

sabrio commented 6 years ago

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.