I am trying to use a RxJS BehaviorSubject
that contains a boolean
representing whether or not a user is connected/logged in the application.
I usually provide SessionService
at bootstrap (and not with providers: []
) to make sure you share one global SessionService
instance throughout the entire app.
bootstrap(AppComponent,
[SessionService]);
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
.