0

I am trying to store class connection object localstorage and get on next page in Angular5, but not receiving correct data object.

here is my code: In component file

this.storage.setVariableToStorage('client', CircularJSON.stringify(client));

In service file

setVariableToStorage(key: string, value: string): void {
    (key == 'client' || key == 'user') ? this[key] = JSON.parse(value) : this[key] = value;
    this.storage.set(key, value);
}

and getting this storage on another component console.log(this.storage.client)

Any help?

Thanks in advance

nick
  • 1,880
  • 17
  • 27
Ritesh Arora
  • 57
  • 11

0 Answers0