everyone!
I need your help. I have a component in my Angular 10 application, let's name it A.
In this component I have <router-outlet>
and also routes described in routes.ts file.
What I need is to change variable (field) inside A component by clicking button from some B component, that is route inside <router-outlet>
. How can I do it?
For example, we can talk about such variant.
A.component.html
<B [changeFieldOfA]="func"></B>
A.component.ts
export class A {
foo: string = "";
func() {
this.foo = "bar";
}
}
Here's everything cool, cause I can pass function, that changes my A component field to my component.
But what if I have this variant?:
A.component.html
<router-outlet></router-outlet>
routes.ts
{path: "b", component: B}
I want to call this func(), that belongs to A (and changes its field) inside B, but i can't do it through Input() anymore, cause in router I can't do it.