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

125
Visualizações
Select2 with Angular works slow with more than 1500 data size

I am using select2 with Angular. I've got a lot of results (about 5k) opening select box is quite slow.

This is my component

    ngAfterViewInit(): void {
    
        $('#carrierSelector').select2({
    
          matcher: (params, data) => {
    
            const { value } = data.element;
            let filter:string = String(params.term).toLowerCase();;
            const { Name, CarrierId, CarrierName } = this.carriers.find((item:ICarrier) => item.index === parseInt(value));
    
            // If there are no search terms, return all of the data
            if ($.trim(params.term) === '') {
              return data;
            }
    
            if (Name.toLowerCase().indexOf(filter) > -1 ||
                CarrierId.toLowerCase().indexOf(filter) > -1 ||
                CarrierName.toLowerCase().indexOf(filter) > -1) {
    
                let modifiedData = $.extend({}, data, true);
                return modifiedData;
    
            }
    
            // Return `null` if the term should not be displayed
            return null;
    
          }
    
        });
    }

I tried a lot of ways like ajax, but it doesn't work for me

about 4 years ago · Juan Pablo Isaza
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