From be48ba1b06c2b6450b8d8003e489b5d8c16eecaa Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 26 May 2016 15:03:23 -0400 Subject: [PATCH] fix(ngRouteShim): update anchors to function similar to angular 1.x (#8478) * fix(ngRouteShim): update anchors to function similar to angular 1.x when setting the target * fix(ngRouteShim): update anchor target check to use indexOf instead of contains on array --- modules/angular1_router/src/ng_route_shim.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/angular1_router/src/ng_route_shim.js b/modules/angular1_router/src/ng_route_shim.js index ba15c575ef..bdb29bf851 100644 --- a/modules/angular1_router/src/ng_route_shim.js +++ b/modules/angular1_router/src/ng_route_shim.js @@ -281,7 +281,10 @@ } var href = element.attr(hrefAttrName); - if (href && $rootRouter.recognize(href)) { + var target = element.attr('target'); + var isExternal = (['_blank', '_parent', '_self', '_top'].indexOf(target) > -1); + + if (href && $rootRouter.recognize(href) && !isExternal) { $rootRouter.navigateByUrl(href); event.preventDefault(); }