K
K
Konstantin2020-12-08 21:41:02
Angular
Konstantin, 2020-12-08 21:41:02

Ngif to change components?

I have a component Filter and Sorting

Each input component has a list with key/value values.

There are also tabs on the page, by clicking on the first one the necessary filter and sorting should be loaded.

The question is, how best to do this, pre-define two filters and two sorts in the template?

App-filter
App-filer

App-sort
App-sort

AND show the required ones via ngif

Or have one instance:

App-filter
App-sort

AND push, depending on Tab, the required input
parameters?

How to implement it correctly?

In short, there are two data components on the page, each must have its own implementation of filtering and sorting. When switching a component with data through a tab, you need to show one or another filter and sorting.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2020-12-13
@Junart1

Well, you can either attach routes or use ngSwitch / ngIf.
It is almost always more convenient to define individual components, but this depends on the specific case.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question