Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

95
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda