U
U
Urukhayy2017-09-23 17:57:30
Angular
Urukhayy, 2017-09-23 17:57:30

Optimal way to work with router-outlet?

Angular 4.

<h2>{{dynamicHeaderFromPage}}</h2>
<router-outlet>SomeContentFromDynamicPage</router-outlet>

We need h2 to be updated along with router-outlet changes. For example, the outlet might contain information about the character, while the h2 should contain the name of the character. What is the best way to implement this?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
Fedor Sazonov, 2017-09-25
@Urukhayy

From the documentation, I think this is your case.

M
Makito, 2017-09-23
@Makito

As for me, if there are components that are not hierarchically connected, then in order to exchange data between them, you need to use which thread the data bus. There are two options here - either the parent receives the data and shares it with the children through the bus, or the child does the same.
It's like no other way.

O
ozknemoy, 2017-09-23
@ozknemoy

it is necessary to look towards subjectBehaviour from rx. well, don't mess with router-outlet

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question