title: In Angular, how to find the route that "called" the controller from inside the controller?
body: <p>I know that it's possible for two or more routes to share the same controller. However, at the controller, I would like to know which route "called" it. Why? Which route would determine whether I would load a list of records, load one record by its id, or not load anything at all.</p>
  
  <p>I have the following route configuration:</p>
  
  <pre><code>angular.module("app").config(function ($routeProvider) {
  
      $routeProvider.when("/", {
          templateUrl: "home.html"
      }).when("/records", {
          templateUrl: "records.html",
          controller: "RecordsController"
      }).when("/record/create", {
          templateUrl: "editRecord.html",
          controller: "RecordsController"
      }).when("/template/edit/:id", {
          templateUrl: "editRecord.html",
          controller: "RecordsController"        
      }).otherwise({
          redirectTo: "/"
      });
  
  });
  </code></pre>
  
  <p>I want to use only one controller, so I have one:</p>
  
  <pre><code>angular.module("app").controller("RecordsController", function($http, $routeParams){
       /* I know that if $routeParams.id exists, it's probably the
          /record/edit/:id route. But if $routeParams.id is null/undefined,
          I don't know which of /records or /record/create "called"
          this controller. I would like to know which route so I can
          decide to load a list (if /records) or not (for /record/create).
       */
  });
  </code></pre>
  
  <p>Unless there are some tricks to pull from the route configuration, like with resolve, somehow?</p>