As in the title, $stateParams
will return undefined.
The route where I define the param works fine, and the url gets the parameter that is being passed.
The module in that view I'm redirected to works but I get the said error.
The module looks like this:
class TripDetailsModuleCtrl {
constructor($scope, $stateParams) {
'ngInject';
$scope.viewModel(this);
console.log($stateParams); // returns undefined
}
}
How else should I try to access $stateParams
?
For anyone having this issue, if your component is defined like this:
controller: ['$scope', TripDetailsModuleCtrl]
make sure to pass $stateParams
as an argument there like so:
controller: ['$scope', '$stateParams', TripDetailsModuleCtrl]