I have two components navbarcomponent and logincomponent.
<app-navbar></app-navbar>
<app-login></app-login>
navbarcomponent get executed before the logincomponent.
In my logincomponent while the user login i set the the user informations in local storage.
and i'm calling it in ngoninit of my navbarcomponent.
ngOnInit() {
this.user = localStorage.getItem("user");
}
But the user variable is always null . because it get executed before the logincomponent instantiate it.
Is there a way to get the value after the method in login get executed ?