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

178
Visualizações
Global component with different search api , how to load service depending of service ? using Angular

i did a global component search. And works well, I pass on everything what component need. But I have a problem with the service architecture. All my http search calls are in one global component within the ts.component file.

I have 3 different http calls. Each is a separate module. For example I have a search name, a customer, and employee. In order to import the search component within the Customer component and search for customers, I need to import and employee the name module as well, because everything is inside the global-search component.

global component shared component ->

            <input type="text"
                   (input)="onSearch($event)"
                   #focus
                   [placeholder]="settings.text"
                   class="w-100 h-100 border-0 shadow-none" />

With @Input() I props all data to child component.. and searching depending of prop data. Work good except loading all modules.

my architecture of folder:

shared/components/search-global-component:

inside search-global-component folder I have:

search-global-component.html
search-global-component.ts.
search-global-component.module
search-global-component.scss

inside module:

i export exports: [SearchGlobalComponent],

How to use in different components:

example inside name or customer or employee components I import SearchGlobalComponent.module

                    <global-search 
                     [(ngModel)]="searchedItem"
                     [primaryKey]="nameId" or customerId
                     [text]="'Select service types'"  ></mglobal-search > 

Here is problem inside NAME I need to import CUSTOMER MODULE AND EMPLOYEE MODULE

how to avoid it? Where to register service ? Do you understand my problem??

if i wanted to add a search global component to another component in that component i would have to import all the modules used within the global search component just because i do http service call to get all values for name . customer , employees or new added component

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