I have an angular template form with about 100 inputs. many of them are capturing values from different mat-selection-lists. I was able to bind to ngModel for basic inputs. however, the values from a multi select list is in a string array format. like ["D", "V"]. the API in the backend takes a string for storing the value and I ended up with a lot of manual conversion using JSON.stringify to store it and then using str.split(",") to convert it before binding to the element.
Is there a way in Angular to auto transform the data in ngModel? Is there a way to do this with ControlValueAccessor / Directive ?
<mat-selection-list [(ngModel)]="formData.input98">
<mat-list-option value="D">D</mat-list-option>
<mat-list-option value="V">V</mat-list-option>
<mat-list-option value="T">T</mat-list-option>
</mat-selection-list>
