You can’t pass arbitrary parameters between states, you need to have them defined as part of your $stateProvider
definition. E.g.
$stateProvider
.state('contacts.detail', {
url: "/contacts/:contactId",
templateUrl: 'contacts.detail.html',
controller: function ($stateParams) {
console.log($stateParams);
}
}) ...
The above will output an object with the contactId property defined. If you go to /contacts/42
, your $stateParams
will be {contactId: 42}
.
See the documentation for UI-Router URL Routing for more information.