Issue with RxJs BehaviorSubject's subscriber not being notified of value change

前端 未结 2 587
误落风尘
误落风尘 2020-12-19 13:20

I am trying to use a RxJS BehaviorSubject that contains a boolean representing whether or not a user is connected/logged in the application.

<
2条回答
  •  旧巷少年郎
    2020-12-19 14:04

    It seems like you have multiple instances of SessionService. e.g. you provided it more than once and the instance that you call signin in is not the same instance as the one you injected in NavbarComponent.

    It depends on your project design how you provide your services. Usually session services are singletons.
    I recommend removing providers: [SessionService], from NavbarComponent.

提交回复
热议问题