Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.
This repository was archived by the owner on Jan 29, 2026. It is now read-only.

When using RouteProvider separately to the StateProvider, state not updated on route param change #128

@mcampster

Description

@mcampster

When defining a state independently of the route e.g. define the state with the $stateProvider, then map the route to the state using the $routeProvider, the state is not correctly reloaded when one of the route params changes e,g

$stateProvider.state('contact', {
                views: {
                    'main': {
                        template: 'contact.html',
                        controller: 'contactController'
                    }
                },
            })

$routeProvider.when('/contacts/:contactId', { state: 'contact') })

I would expect that when the 'contactId' changes, the state should be reloaded, as it is when you declare the route on the state itself...

$stateProvider.state('contact', {
                route: '/contacts/:contactId',
                views: {
                    'main': {
                        template: 'contact.html',
                        controller: 'contactController'
                    }
                },
            })

The reason I am declaring the routes using the routeProvider is so that we can map 1 or more routes to the same state. If there is another way of doing this, perhaps the above issue would not need solving?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions