Angular 2: sharing data across different routes

前端 未结 3 1068
死守一世寂寞
死守一世寂寞 2021-02-15 11:51

I have searched for similar questions in SO and I have not found any that addresses my specific case. There are many techniques to share data between angular components, and I h

3条回答
  •  半阙折子戏
    2021-02-15 12:04

    What do you think about NgRx solution inspired by Redux? You can read more there - https://github.com/ngrx/store

    You will have a single application store, which can be subscribed in the proper components. So - you could just dispatch an event before route changed. This soulution use only reducers, so in different ways than using store, your data would be immutable - this is the next advantage.

提交回复
热议问题