InfomediaLtd / angular2-materialize

Angular 2 support for Materialize CSS framework.
https://infomedialtd.github.io/angular2-materialize/
MIT License
407 stars 140 forks source link

Multi select with FormArray #419

Open guzmo opened 6 years ago

guzmo commented 6 years ago

Hi,

I've been trying to hook up multi select to a FormArray of Objects, so far without any luck. How to connect a select to an FormArray of objects? Below is a code snippet, a bit masked but shouldn't matter.

<select formControlName="myArray" multiple materialize="material_select" [materializeSelectOptions]="my.options">
     <option *ngFor="let opt of my.options" [selected]="selectedOpt(opt)" [value]="opt">{{opt.name}}</option>
</select>

The form is being initialized on the fly but I've tried adding this.optionsAction.emit('material_select') after, and it didn't help.

Any help would be appreciated!