Open mcampster opened 9 years ago
There is still a piece missing in this on for it to work with no routes on the state at all.
But for the more conceptual part, I would still recommend giving a route to an actual state... Which will act as a main route for that state... Reason being that it enables URL generation for states...
You can still add additional routes pointing to the state after that. So in essence you would have:
$stateProvider.state('contact', {
route: '/contacts/:contactId',
views: {
'main': {
template: 'contact.html',
controller: 'contactController'
}
},
})
$routeProvider.when('/anotherurl/:contactId', { state: 'contact') })
and Example: http://plnkr.co/edit/UtuBVXrr89cizzqz4IFU?p=preview (Running current latest from master, I wan't this issue fully fixed before I do a release)
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
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...
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?