I am looking to assign class variables with values from session storage if they exist, otherwise the variable will retain its default value initialized in ngOnInit.
private getTableSessionItems = () => {
var tSession = JSON.parse(sessionStorage.getItem('tableSession'));
if(tSession){
for (var property in tSession) {
if (tSession.hasOwnProperty(property)) {
this[property] = tSession[property];
}
}
console.log('tableSession is true');
}
else{
this.setTableSessionItems();
console.log('nope keep trying', tSession);
}
}