Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

94
Views
Implement multiple autocompletes for one input

I currently have an input field that has an autocomplete, I’m trying to have essentially a two stage autocomplete for each entered item, for example typing I would show IP Address, selecting that enters “ipAddress=“ into the input, I would then like to display another autocomplete in the same input based on the selected option to display the available addresses. Then they would add a comma and repeat to add any other filters. I just am not sure what this would be called or how to implement this so any tips or ideas would be greatly appreciated

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try something like this:

TS:

itemList: any[] = [
  { name: "item1", IPForm: new FormControl(), AnotherListValue: [], AnotherForm: new FormControl() },
  { name: "item2", IPForm: new FormControl(), AnotherListValue: [], AnotherForm: new FormControl() }
];

// Fill my another value regarding to selected IP
onSelectedIP(selected: any, item: any) {
    this.myService.getListValue(selected.IP).subscribe(result => item.AnotherListValue = result);
}

HTML

<div *ngFor="let item of itemList">
    <mat-form-field>
        <input type="text" placeholder="Select IP" matInput [matAutocomplete]="itm" [formControl]="item.IPForm">
        <mat-autocomplete autoActiveFirstOption #itm="matAutocomplete" [displayWith]="displayFn" (optionSelected)="onSelectedIP($event.option.value, item)">
            <mat-option *ngFor="let option of IPList | async" [value]="option">
                {{option.IP}}
            </mat-option>
        </mat-autocomplete>
    </mat-form-field>
</div>

You just need to add second auto-complete and so on

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!