0

I have the following code which routes some of my URLs:

        .when('/patient/:patient', {
            templateUrl: 'views/patient.html',
            controller: 'DashboardCtrl',
            controllerAs: 'dashboard'
        })

I am looking to access the :patient information from the scope. What is the most direct method to access that information from the scope?

In other words, how do I know which patient the URL is at?

  • This might help: http://stackoverflow.com/questions/4758103/last-segment-of-url - what you can do is parse the whole url, find the last `/` and extract what's after that character. – Alex Szabo Dec 22 '15 at 14:25
  • thanks but this isn't the answer I'm looking for. Why does AngularJS make us specify :patient instead of :*? – ProfessorManhattan Dec 22 '15 at 14:27

1 Answers1

1

Just inject $routeParams into your controller and assign $routeParams['patient']to a property of your scope.