fix(angular1_router): ngLink should not throw an error if routeParams are undefined (#8460)

If routeParams are undefined, no href attribute should be rendered. This matches the behaviour of ngHref.
This commit is contained in:
David Reher
2016-05-20 18:48:03 +02:00
committed by Miško Hevery
parent 3857c8226e
commit 9b1b5b393d
2 changed files with 16 additions and 0 deletions

View File

@ -213,6 +213,10 @@ function ngLinkDirective($rootRouter, $parse) {
let link = attrs.ngLink || '';
function getLink(params) {
if (!params) {
return;
}
navigationInstruction = router.generate(params);
scope.$watch(function() { return router.isRouteActive(navigationInstruction); },