title: Is it possible to fetch templates from $templateCache when configuring my $routeProvider?
body: <p>My intention is to load all the templates of my web app with one single call to an external JSON file containing a list of all the template names and values.</p>
  
  <p>I am currently loading these templates on the run phase of my app:</p>
  
  <pre><code>app.run(function ($http, $templateCache) {
      $http.get('/templates/all.json').success(function (data) {
          var i;
          for (i = 0; i &lt; data.length; i++) {
              $templateCache.put(data[i].name, data[i].template);
          }
      });
  });
  </code></pre>
  
  <p>However, the Angular.js config phase executes before the run phase, so when I intend to load from the templateCache:</p>
  
  <pre><code>app.config(function($routeProvider, $locationProvider) {
      //App routing
      $routeProvider.
          //Homepage
          when('/', {templateUrl: 'home.html'}).
  
          //My schedule
          when('/my-schedule', {templateUrl: 'my-schedule.html'});
  });
  </code></pre>
  
  <p>Angular tries to load <code>home.html</code> from the server, because the <code>$templateCache</code> hasn't been filled yet.</p>
  
  <p>Suppose that <code>all.json</code> contains the templates for <code>home.html</code> and <code>my-schedule.html</code> for the prevous example.</p>
  
  <p>Is it possible to fill <code>$templateCache</code> before configuring the app's <code>$routeProvider</code>?</p>