I defined these routes:
.state('sport', url: '/sport' templateUrl: '/templates/sport' controller: 'SportCtrl' ) .state('sport.selected' url: '/:sport' templateUrl: '/templates/sport' controller: 'SportCtrl' )
And I am trying to use this controller: a sports parameter specified by sport.selected state.
angular.module('myApp') .controller('SportCtrl', ['$scope', 'ParseService', '$stateParams', function ($scope, ParseService, $stateParams) { var sportURL = $stateParams.sport; ... });
For some reason, it returns undefined when I call $ stateParams.sport in the controller, although I think I defined it in the routes. Why is this so?
Thank you for your help!
angularjs angularjs-controller angular-ui-router
nggonzalez
source share