Akhil Tyagi
Akhil Tyagi

Reputation: 81

How to load multiple component with one route angular

I am loading different component on route match.

{
  path: '', component: MainComponent,
  children: [
    {
      path: '',
      component: ProjectComponent,
    },
    {
      path: "business/:id",
      component: BusinessComponent
    },
    {
      path: "category/:id1/:id2",
      component: CategoryComponent
    },
  ]
}

Now I need to add search route where need to show all components as per search match.

How can I show all components(ProjectComponent, BusinessComponent & CategoryComponent) together to display search result?

Upvotes: 0

Views: 1041

Answers (1)

Gendy
Gendy

Reputation: 131

Create a new component for search results and inside this component use all of the other three components.

results template for example

<div>
  <!-- any header, page title, search input .... -->

  <app-project></app-project>
  <app-business></app-business>
  <app-category></app-category>

</div>

and pass data as inputs if needed

Upvotes: 1

Related Questions