I work on autocomplete text box on angular 7 I face issue when I write on text box
search or filter not work and not give me result .
actually when I write on text box auto complete related data must display but this not happen .
- class deliverysys.ts
- export class deliverysys {
- constructor(public optionId: number, public optionName: string) { }
- }
- DeliverySystemComponent.ts
- export class DeliverySystemComponent implements OnInit {
- myControl = new FormControl();
- ExportOptions: deliverysys[];
- constructor(private http: HttpClient,private _dataService: DeliverySysService) {
- this._dataService.getExport().subscribe(data => { this.ExportOptions = data
- console.log(this.ExportOptions)
- });
- }
- getselected(value,index) {
- console.log("selected is" + index)
- }
- }
this display data as below :
- this.ExportOptions
- (5) [{…}, {…}, {…}, {…}, {…}]
- 0: {optionID: 1, optionName: "Export"}
- 1: {optionID: 2, optionName: "Export Normalized"}
- 2: {optionID: 3, optionName: "Export Normalized New"}
- 3: {optionID: 4, optionName: "Export Normalized Relation"}
- 4: {optionID: 5, optionName: "Export Nxp Comptitor"}
- DeliverySystemComponent.html
class ="example-full-width">- "text" placeholder="Select Exporter" aria-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto">
"matAutocomplete" >"getselected(exp.optionName,i+1)" *ngFor="let exp of this.ExportOptions;let i = index" [value]="exp.optionName">- {{exp.optionName}}
as you see image below when write any text not found
not give me not found
also if word I write found auto complete not changed and not give me related result

so How to solve issue of not displaying data related when I write or filter data ?
Replies
Know the answer? Post it — somebody with the same question will find it here.