Reputation: 12695
in my stateProvider
definition I have:
return function ( $stateProvider ) {
return $stateProvider.state('welcomeCAReg', {
url: '/myURL/:id',
templateUrl: 'hi.html',
controller: 'hiController'
})
and then, in the controller I want to read the :id
param:
$locationProvider.html5Mode().enabled = true;
....
var paramValue = $location.search().id;
but the paramValue
value is undefined, why ?
Upvotes: 1
Views: 35
Reputation: 193261
You should use $stateParams
service:
function hiController($stateParams) {
console.log( $stateParams.id )
}
Upvotes: 1