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:

committed by
Miško Hevery

parent
3857c8226e
commit
9b1b5b393d
@ -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); },
|
||||
|
Reference in New Issue
Block a user