I wanted to know if you guys now a way to have the @Input + ngOnChanges() combination or something doing the same inside a component in .
Basically, I have set a logged: boolean
variable in my AppComponent and in my template I have :
<router-outlet></router-outlet>
<login [logged]="logged"></login>
What I want is to be able to watch that logged
variable inside a component in the router-outlet so I make stuff here only when logged is as set as true.
I've tried to put <router-outlet [logged]="logged"></router-outlet>
but that doesn't work, and using a variable in a service seems not to fit the ngOnChanges() watch.
Has anyone an idea ? Thanks !
logged
property an observable so that other components can subscribe to it and react to changes. If I remember correctly, there is a way to write an observable such that when something subscribes to it, they receive the last data pushed into the stream. – Alex Florin