From 335f2a7ecb927bc7f2bc68fa2462be1f353d8f55 Mon Sep 17 00:00:00 2001 From: Rob Eisenberg Date: Thu, 7 Jul 2016 16:52:48 -0400 Subject: [PATCH] fix(route-recognizer): respect explicit href during generation Fixes https://github.com/aurelia/router/issues/347 --- src/route-recognizer.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/route-recognizer.js b/src/route-recognizer.js index d069641..a648509 100644 --- a/src/route-recognizer.js +++ b/src/route-recognizer.js @@ -113,13 +113,17 @@ export class RouteRecognizer { * @returns The generated absolute path and query string. */ generate(name: string, params: Object): string { - let routeParams = Object.assign({}, params); - let route = this.names[name]; if (!route) { throw new Error(`There is no route named ${name}`); } + let handler = route.handlers[0].handler; + if (handler.href) { + return handler.href; + } + + let routeParams = Object.assign({}, params); let segments = route.segments; let consumed = {}; let output = '';