title: How can I generate correct detail url using aurelia router?
body: <p>One of my application's view-models resides under the routes: </p>
  
  <pre><code>http://localhost:9000/#/historical-orders/
  http://localhost:9000/#/historical-orders/page/2/
  http://localhost:9000/#/historical-orders/page/3/
  </code></pre>
  
  <p>and so on. It's a <code>list view-model</code>, so whenever user clicks on one of it's rows, he or she should be directed to:</p>
  
  <pre><code>http://localhost:9000/#/historical-orders/details/:orderId
  </code></pre>
  
  <p>Seems simple enough, right? However there's a problem with route generation. Namely: if I'm browsing through one of the pages (urls ending with <code>page/:pageNumber/</code>, then calling <code>router.generate</code> gives me details url that looks like that: <code>#/historical-orders/page/1/details/:orderId</code> which is obviously incorrect. My route config:</p>
  
  <pre><code>export class App {
      configureRouter(config, route) {
          config.map([
              {
                  route: ["historical-orders", "historical-orders/page/:pageNumber"],
                  moduleId: "orders/historical-orders-section",
                  name: "historical-orders-section",
                  title: "Historical orders",
                  nav: true
              }
          ]);
      }
  }
  </code></pre>
  
  <p>Historical orders section:</p>
  
  <pre><code>export class HistoricalOrders {
      configureRouter(config, router) {
          config.map([
              { 
                  route: "", 
                  moduleId: "orders/historical/orders-list", 
                  title: "Orders history", 
                  nav: false
              }, 
              {
                  route: "details/:id",
                  moduleId: "orders/historical/order-details",
                  name: "historical-orders-details",
                  title: "Details",
                  nav: false
              },
          ]);
      }
  }
  </code></pre>
  
  <p>And the detail-view route generation looks quite ordinarily:</p>
  
  <pre><code>this._router.generate("historical-orders-details", { id: order.pk });
  </code></pre>
  
  <p>So how to make the router generate proper urls?</p>