javascript - Angular sm-select: select all when loading -
i select options when loading sm-select. possible mark option selected in *ngfor loop?
i tried fill multipledata array in nginit doesn't work me.
could please help?
// file dashboard.component.html contains <div class="ui form"> <label for="multiplecontrol">categories</label> <sm-select *ngif="categories" [options]="{direction: 'downward'}" [(model)]="categories" placeholder="kategorie..." class="fluid search multiple" (onchange)="onmultiple('categories', $event)"> <option *ngfor="let category of categories [value]="category.id">{{category.name}}</option> </sm-select> </div> //my file dashboard.component.ts contains categories: category[]; loadcategories() { this.influencerservice.getcategories().subscribe(categories => { this.categories = categories; }, err => { console.log(err); return false; } ); } onmultiple(data: array<category>): void { this.multipledata = data; console.log(this.multipledata); }
Comments
Post a Comment