I am having trouble getting and setting a session. Here is my code:
login_btnClick() {
var NTLoginID = ((document.getElementById("NTLoginID") as HTMLInputElement).value);
this._homeService.get(Global.BASE_USER_ENDPOINT + '/EmployeeDetailsApi?user_id=' + NTLoginID)
.do(data => sessionStorage.setItem('session',JSON.stringify(data)))
.subscribe(homes => { this.homes = homes; this.indLoading = false; },
error => this.msg = <any>error);
var session = sessionStorage.getItem('session');
alert(JSON.stringify(session));
this.router.navigateByUrl('/user');
}
I keep receiving only null instead of the actual value. I can see the value from
.do(data => alert(JSON.stringify(data)))
. As a newcomer to angular2, I would appreciate any assistance.