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
This commit is contained in:
Jon 2016-05-26 15:03:23 -04:00 committed by Miško Hevery
parent b2a7fd05cb
commit be48ba1b06
1 changed files with 4 additions and 1 deletions

View File

@ -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();
}