In login page i am saving one value in array ,after login in home page i need to use that,but it showing undefined ,and when i refresh the page its fine. The login page code that i used is,
this.userRoles.push({"id":1,"name":test});
sessionStorage.setItem('roles',JSON.stringify(this.userRoles));
When i inspect the sessionStorage it showing, the home page code that i used to retrieve the session value is,
this.roles = JSON.parse(sessionStorage.getItem('roles'));
but it showing undefined