Skip to content

Allow to pass data with router.navigate #25658

@earshinov

Description

@earshinov

I'm submitting a...

[x] Feature request

Current behavior

Currently Angular does not provide a way of passing additional data with router.navigate.

There are many use cases for this, described in related issues which were unjustly closed without fulfilment:

#10248 is not actually closed, but addresses only a part of the problem.

Expected behavior

Here is an example how it could work taken from #5217:

// exactly like @RouteConfig
this.router.navigateByUrl('/path', { data: { entity: 'entity' } })

The given data should be accessible everywhere where route.data is accessible (in the target component, resolvers if any etc.)

Environment

Angular version: from 2 up to the current.

Additional Information

There is a workaround by @hipparch:
https://github.com/Hipparch/Angular2-navigate-with-data

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: routerfeatureLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationfreq3: high

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions