title: How to inject services into RouteInitializerFn (new routing DSL)
body: <p>I'm switching my app over to the new routing DSL.  Specifically, I want to do something like this with <code>preEnter</code>:</p>
  
  
  
  <pre class="lang-dart prettyprint-override"><code>final RouteInitializerFn routes =(Router router, ViewFactory views) {
    views.configure({
     'chat': ngRoute(
       path: '/chat',
       // authService.requireState returns a Future&lt;bool&gt;, and may invoke an HttpRequest
       preEnter: (RoutePreEnterEvent e) =&gt; e.allowEnter(authService.requireState(LOGGED_IN)),
       view: 'views/chat.html'),
  
     'login': ngRoute(
       path: '',
       defaultRoute: true,
       view: 'views/login.html')
    });
  }
  </code></pre>
  
  <p>This would be configured in the module as follows:</p>
  
  <p><code>value(RouteInitializerFn, routes);</code></p>
  
  <p>In case you missed it, I'm referencing an injectable <code>authService</code> within the <code>RouteInitializerFn</code>.  This isn't possible since <code>RouteInitializerFn</code> is a function and not a class, so nothing can be injected into it.  If I encapsulated the <code>routes</code> function within a class, I'm not sure how I could configure <code>RouteInitializerFn</code>, so I'm in a bit of a quandary. </p>