Problem:
When I navigate to #/
it tries to load the profile
state which is at #/:userId
.
So I'm completely perplexed by this functionality as it is seemingly intermittent. I already referred to this question and it seems that shuffling the order has no affect.
I want to have clean routes with UI-Router:
#/
This is the user's root dashboard
#/123
This is a specific user profile
#/my/preferences
This is some other route.
$stateProvider
.state('profile', {
abstract: true,
url: '/:userId',
templateUrl: 'profile-user.html',
controller: 'ProfileController',
controllerAs: 'vm',
reloadOnSearch: false,
resolve: {
data: function() {
// some promises stuff
}
}
})
.state('profile.activity', {
url: '',
templateUrl: 'activity.html'
})
.state('dashboard', {
url: '/',
templateUrl: 'dashboard.html',
controller: 'DashboardController',
controllerAs: 'vm',
reloadOnSearch: false,
resolve: {
data: function() {
// some promises stuff
}
}
})
.state('preferences', {
url: '/my/preferences',
templateUrl: 'preferences.html',
controller: 'PreferencesController',
controllerAs: 'vm',
reloadOnSearch: false,
resolve: {
data: function() {
// some promises stuff
}
}
})
Question:
Is there a way to have #/
, #/:param
and #/someRoute/:someId
be different states in UI-Router? Also, is there a way to see what routes are registered and in what order in UI-Router? That would be tremendously helpful during debugging.