Below is a sample state hierarchy,
.state('home', {
url: '/home',
templateUrl: 'views/home.html',
controller: 'HomeCtrl'
})
.state('home.books', {
url: '/:collectionId',
abstract: true,
controller: 'BooksCtrl'
})
.state('home.books.displaybooks', {
url: '^/books',
templateUrl: 'views/displaybooks.html',
controller: 'DisplayBookCtrl'
})
In home.books.displaybooks state, I display the collection of books.
I can access this state by two means,
- By clicking on the link in "home" state. I use ui-sref and pass the default collection id for the user. No problems here
- By URL routing http://localhost/books (please note the ^ in url in state definition. I want absolute url without displaying the collectionId in the address bar). Here the problem is that the state does not get the collectionId parameter. So can some please point how I can insert the default collectionId of the user when I am navigating to the state through URL routing.
Thanks,