I have a root component that has a changing boolean and I want to subscribe to that changing boolean, with a component within my <router-outlet>
. I understand I need to use a shared bidirectional service of some sort. However, the docs for shared services just arent making a whole lot of sense to me. (I guess I cant wrap my head around the astronaut example) here, any help would be greatly appreciated, here is a little bit of code to show what I am trying to do.
root component
@Component({
selector: 'my-app',
template: `<nav [state]="boolshow" (show)="changeValue($event)" ></nav>
<article><router-outlet></router-outlet></article> <-----component in router here
<footer></footer>
<h3>toggle state: {{boolshow}}</h3>`,
styleUrls: ['./Css/app.css'],
})
export class AppComponent {
boolshow: boolean; <-----boolean that needs to be read
}