Angular - Return ID from URL Path in Controller Angular - Return ID from URL Path in Controller angularjs angularjs

Angular - Return ID from URL Path in Controller


Try $routeParams instead:

app.controller('ticketController', ['$scope', '$routeParams',   function ($scope, $routeParams) {      //Get ID out of current URL      var currentId = $routeParams.id;}]);


If you are using ui-router so try $stateParams:

app.controller('ticketController', ['$scope', '$stateParams',   function ($scope, $stateParams) {      //Get ID out of current URL      var currentId = $stateParams.id;}]);