Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate event from Child routers instead of root router #293

Closed
jsobell opened this issue Feb 15, 2016 · 7 comments
Closed

Generate event from Child routers instead of root router #293

jsobell opened this issue Feb 15, 2016 · 7 comments

Comments

@jsobell
Copy link

jsobell commented Feb 15, 2016

We currently have EventAggregator events raised for the router, but these are generated from and refer to the root router only.
When creating global actions relating to routers (such as context sensitive information, such as discussed in #281, we need routing information from the children too.
Given that we can easily walk up the chain of routers, it makes sense that the raised events include the information as to which is the final router instance involved in the route, as this contains all of the params from the current and parent route variables.
The only current workaround (I could find) is to add a method to the activate(params) of every VM and raise the event there.

@swiftanthony
Copy link

Same issue here. Are there any updates on this ?

@EisenbergEffect
Copy link
Contributor

It sounds like we can add this pretty easily. Would anyone care to spec it out and provide a few more implementations details?

@droda59
Copy link

droda59 commented Aug 9, 2016

Same issue. The aurelia-google-analytics plugin needs the route's title to send data, but the events raised from the child router navigation doesn't include this information. @miguelzakharia

@dweber019
Copy link

I have the same issue here. I like to receive the child router route config which is currently active.

Here an example:

Given:
I have a root router with a route customers and a child router has a route /:id with the property settings configured in the route definition.

Then:
Navigate to child router route /:id.

Expect:
Event router:navigation:complete is fired and the instruction provided in the event has the instruction of the child router with the settings which have been configured.

I think only the currently active router should fire events.

This should be implemented for all events:

  • router:navigation:processing
  • router:navigation:error
  • router:navigation:canceled
  • router:navigation:success
  • router:navigation:complete

@dweber019
Copy link

I found a solution for my use case. To get the setting of a child router route i can call instruction.getAllInstructions() to get all route instructions. The last instruction is then the one with the information i need.

@Alexander-Taran
Copy link
Contributor

maybe can be closed?
or considered for vNext

@Alexander-Taran
Copy link
Contributor

@EisenbergEffect added to vNext router use cases.
Can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants