instanceID declared as a parameter, so we can access it as follows
.controller('ViewWorklogCrtl', [ '$scope','$stateParams' function($scope , $stateParams ) {
All other details can be found here https://github.com/angular-ui/ui-router/wiki/URL-Routing
And the ui-sref should look like this:
<a ui-sref="instance-ticket.worklog({ instanceID:ticket.testnum })" >..
Expansion:
In case we want to get two parameters: 1) instanceID from the parent 2) testnum from the current, we must adjust the state, as shown
.state('instance-ticket', { url: '/ticket/:instanceID', // instanceID templateUrl: 'partials/instance-ticket', controller: 'ViewTicketCrtl' }) .state('instance-ticket.worklog', { // new param defintion url: '/worklog/:testnum', // testnum views:{ 'top-section':{ templateUrl:'/partials/ticket.worklog.jade', controller: 'ViewWorklogCrtl' } }
And ui-sref
<a ui-sref="instance-ticket.worklog({ instanceID:1, ticket.testnum:2 })" >..
And we can access it as follows:
.controller('ViewWorklogCrtl', [ '$scope','$stateParams' function($scope , $stateParams ) {
Radim Kรถhler Jan 13 '14 at 5:43
source share