I have set up a route and am attempting to send parameters to a controller:
app.js
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('spot', {
url: "/spot/:param",
templateUrl: "templates/spot.html",
controller: "SpotCtrl"
});
$urlRouterProvider.otherwise('/');
});
controller:
angular.module('spotx.controllers')
.controller('SpotCtrl', ['$scope', '$routeParams',
function($scope, $routeParams) {
$scope.do = function() {
console.log($routeParams.param);
};
}])
The URL is /#/spot/1111, but when I call the do-function, I receive undefined in the console.