I have A component which has the following template
<div> This is A component </div>
<router-outlet></router-outlet>
If I use url
site.com/A/B
then angular loads A component and puts B inside A's template.
A component has:
export class SettingsComponent implements OnInit {
someVar;
ngOnInit() {
this.someVar = "TEST"
How can I get this variable while starting B component ???
EDIT I don't want to use service for each of them because that TEST I get from API. And I think I will load server twice with such request. Instead of that I want to get it only once. Like in this example suppose I get reply from server and put it inside this.someVar = "TEST"
So second component should only use first component data not touching the backend server API.