fix(angular_1_router): ng-link is generating wrong hrefs

At the moment ng-link is generating html5mode URLs for `href`s.
Instead it should check whether or not html5mode is enabled and create
the `href`s accordingly. The renaming in the `getLink` function is
aligning it to `RouterLink`'s `_updateLink`.

Closes #7423
This commit is contained in:
David Reher
2016-03-04 09:14:27 +01:00
committed by Pete Bacon Darwin
parent 980491b08f
commit 69c1405196
3 changed files with 103 additions and 102 deletions

View File

@ -316,3 +316,13 @@ Location.prototype.path = function () {
Location.prototype.go = function (path, query) {
return $location.url(path + query);
};
Location.prototype.prepareExternalUrl = function(url) {
if (url.length > 0 && !url.startsWith('/')) {
url = '/' + url;
}
if(!$location.$$html5) {
return '#' + url;
} else {
return '.' + url;
}
};