title: AngularJS - use routeProvider "when" variables to construct templateUrl name?
body: <p>So this is what I am trying to accomplish:</p>
  
  <pre><code>'use strict';
  
  var app = angular.module('myModule', ['ngRoute']);
  
  app.config(function($routeProvider) {
    $routeProvider
      .when('/', {
        redirectTo: '/pages'
      })
      .when('/pages/:pageName', {
        templateUrl: 'views/pages/'+pageName+'html',
        controller: 'MainController'
      });
  });
  </code></pre>
  
  <p>Basically, I want to use the uri to determine which template is used. Currently I get an error that pageName is not defined which I understand. What would be a different way of doing this?
  Thanks!</p>