Can someone assist me with resolving an issue related to ionic $stateParams?
Here is the state configuration:
.state('tabs.categories', {
url: "/categories/:parentID",
views: {
'categories-tab': {
templateUrl: "templates/categories.html",
controller: 'CategoriesCtrl'
}
}
})
The Controller code:
angular.module('myApp').controller('CategoriesCtrl', ['$scope', '$http', '$stateParams', function($scope, $stateParams, $http){
console.log ($stateParams.parentID);
}]);
And if required, the view section:
<ion-view view-title="Categories">
<ion-content>
<a class="button button-clear" href="#/tab/categories/2">cat 2</a>
<a class="button button-clear" href="#/tab/categories/3">cat 3</a>
</ion-content>
The problem I'm facing is that $stateParams.parentID is showing as undefined in the controller. I am unsure of the reason behind this issue. Any help would be greatly appreciated. Thank you.