K
K
Konstantin2020-12-09 19:40:27
Angular
Konstantin, 2020-12-09 19:40:27

How to change components?

I have a DocumentModule .

A wrapper component is loaded in it, which contains <app-sidebar></app-sidebar>and <app-tabs>, in each tab a separate grid component is substituted.

How, when changing tabs, to replace the component <app-sidebar></app-sidebar>- for each tab its own?

Now I know which tab I chose - through the event. How to build the architecture in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MamaLuyba, 2020-12-09
@Junart1

Through ngIf. A variable is made - tabNumber, for example. There, through the event, the ordinal number of the taba is written. And in the markup, ngIf is already hung on the necessary sidebars.
For example, for the first tab <app-sidebar ngIf='tabNumber==="1"'></app-sidebar>.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question