Answer the question
In order to leave comments, you need to log in
How to add object to constructor while executing program in Anuglar 2?
I use Autocomplete so that when I enter a value, I get a filtered array, I need to use
this.filteredOptions = this.myControl.valueChanges
.startWith(null)
.map(val => val ? this.filter(val) : this.options.slice());
<div *ngFor="let item of serviceRequest.items; let ind=index">
<div [ngSwitch]="item.type">
....
<div ngSwitchCase="12">
<md-input-container>
<input mdInput [(ngModel)]="item.text" placeholder="{{form.items[ind].optional_select.label}}" [mdAutocomplete]="auto" [formControl]="myControl">
</md-input-container>
<md-autocomplete #auto="mdAutocomplete">
<md-option *ngFor="let state of item.values | async" [value]="item.text">
{{ state.text }}
</md-option>
</md-autocomplete>
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question