I'm developing an application using Angular 6 and I'm looking for some help/guidance on this. Below is my app component.
app.component.html
--header--
-- router outlet--
--footer--
And I'm invoking two observable http services to get the data in ngOnInit of app.component and storing the value in browser sesionStorage. The two invocations are happening one within another. And I'm trying to read the sessionStorage object in my child component's ngOnInit but the invocation is not happening the way I expected.
Expected:
-- app component - ngOnInit -- Service 1 Invocation --
-- app component - ngOnInit -- Service 2 Invocation --
-- app component - ngOnInit -- Store result into sessionStorage --
-- Child Component - ngOnInit - read object from sessionStorage--
Actual:
-- app component - ngOnInit -- Service 1 Invocation --
-- Child Component - ngOnInit - read object from sessionStorage--
-- app component - ngOnInit -- Service 2 Invocation --
-- app component - ngOnInit -- Store result into sessionStorage --
As the child component is not able to read the object from sessionStorage, it fails. And I'm trying to understand what am I missing here?
TIA