2

I have 2 components: ProcessComponent & ClientTypeComponent binded to routes.

const routes: Routes = [
    {
            {path: 'login', component: LoginComponent},
            {path: 'home', component: HomeComponent, canActivate: [AuthGuard]},
            {
                path: 'process', component: ProcessComponent, canActivate: [AuthGuard], children: [
                    {path: 'client-type', component: ClientTypeComponent, canActivate: [AuthGuard]}
                ]
            }

];

How can I just send a simple boolean value from /process/client-type to /process

I can't use neither data-binding or EventEmitter since I don't use nested components but nested routes.

There is probably a way but I can't find any answers.

1
  • something like this (from the angular docs): this.router.navigate(['/heroes', { id: heroId, foo: 'foo' }]); or as already mentioned, use a service Commented Mar 28, 2018 at 10:24

2 Answers 2

1

try this i think it's duplicate of How do I pass data to Angular routed components?

Sign up to request clarification or add additional context in comments.

2 Comments

this isn't a duplicate but maybe I can use it. Send an event to a service that sends an other event to my parent component
yes you can use it and i think it proper way to pass a data from one to other
0

You should use service to get the value. You store the value in service before routing to 'client-type'. Get the value in ngOninit of ClientTypeComponent

1 Comment

The value can change in ClientType component, so it can't be onInit

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.