I have session variable in
home.component.ts
session
user.compnent.ts
dashboard.component.ts
home.component.ts
var session = sessionStorage.getItem('session');
user.component.ts
import { HomeComponent } from '../Components/home.component';
constructor(private fb: FormBuilder, private _userService: UserService,
private _HomeComponent: HomeComponent, private router: Router) { }
Angular
Since you are alreayd using sessionStorage
, the variables stored in will be accessible throught the page. so you need the following in the dashboard.component.ts
var session = sessionStorage.getItem('session');