how to select default items in angular material 2 select multiple -
i'm working on angular 2 material app, have case there multiselect element , in have list checkbox can select multiple items @ time. i'm able to angular material component, want 2-3 items checked default, , if select/deselect particular item, should checked/selected flag true/false.
<md-select multiple="true" [(mgmodel)]="test"> <md-option *ngfor="let l of list" [value]="l"> {{l.name}} </md-option> </md-select> var list = [{name:'abc'},{name:'cbv'},{name:'hgf'},{name:'rty'},{name:'fdv'},{name:'vbg'}] var test = [{{name:'abc'},{name:'cbv'}]
is there other way around or m going wrong where.
your test
array should contain elements list
array:
list = [{name:'abc'},{name:'cbv'},{name:'hgf'},{name:'rty'},{name:'fdv'},{name:'vbg'}]; test = this.list.slice(0,2);
Comments
Post a Comment