vladotesanovic / ngSemantic

Angular 2 building blocks :package: based on Semantic UI
https://ng-semantic.herokuapp.com/
MIT License
973 stars 148 forks source link

sm select: select all cities by default #192

Closed JacoobL closed 6 years ago

JacoobL commented 6 years ago

Could you please advice me, how to select all cities from example by default. I am using this component as filter and I need to have selected all options when loading page.

`

Multiple

<p><i>Wrapped in 'ui form' for validation.</i></p>
<div class="ui form">
<sm-select [options]="{direction: 'upward', transition: 'vertical flip'}" [control]="multipleControl" placeholder="Select multiple..." 
class="fluid search multiple" (onChange)="onMultiple($event)">
    <option *ngFor="let city of cities">{{city}}</option>
</sm-select>
</div>`

`export class SelectComponent { multipleControl: FormControl = new FormControl("", Validators.required); multipleData = []; selection: string = ""; cities: Array = ["New York", "Belgrade", "Stockholm", "Sarajevo"];

onMultiple(data: Array<string>): void {
    this.multipleData = data;
}

}`