2

When I navigate with angular routerLink, the following code works fine.

However, if I refresh the page, I get undefined value.

this.sub = this._route.fragment.subscribe((collectionKey: string) => {
       this.store.dispatch( new actions.Select(collectionKey));
       const col = this.store.select(fromStore.getSelectedCollection);
       col.subscribe(collection => this.collection = collection);
       console.log(this.collection)
    });

Is there anyway out to solve this?

LearnToday
  • 2,762
  • 9
  • 38
  • 67

1 Answers1

1

If I understand right state is not persistent. This post can answer you question.

Ngrx Strore Resets after browser refresh , How to make the application preserve the state ?