title: $routeProvider - where is the var passed to .when stored
body: <p>I am an amateur with angular. I am using route provider to load separate html pages and controllers. This works fine when I know what pages the site has and I can define them.</p>
  
  <pre><code>app.config(function($routeProvider) {
      $routeProvider
          .when("/page1", {
              templateUrl: "../page1.html",
              controller: "Page1Ctrl"
          })
          .when("/page2", {
              templateUrl: "../page2.html",
              controller: "Page2Ctrl"
          })
          .when("/page3", {
              templateUrl: "../page3.html",
              controller: "Page3Ctrl"
          })
          .otherwise({
              redirectTo: "/page1"
          });
  });
  </code></pre>
  
  <p>However, in future, more pages may be added and I want to code a way for angular to take this into accout. Something like;</p>
  
  <pre><code>app.config(function($routeProvider) {
  
        (..figure out n...)
  
       $routeProvider
           .when("/page"+n, {
                 templateUrl: "../page"+n+".html",
                 controller: "Page"+n+"Ctrl"
           })
           .otherwise({
                 redirectTo: "/page1"
           });
  });
  </code></pre>
  
  <p>I cannot figure out how to return a <code>var</code> listing the current page so I can remove '/page' to manipulate the int as <code>n</code>.</p>
  
  <p>I tried console logging <code>$routeProvider</code> but <code>.when</code> simply returns a function. I don't think injecting <code>$scope</code> is wise because obviously a var is passed somewhere using <code>$routeProvider</code> alone.</p>