angular/packages/core
Andrew Scott ccb09b4558 fix(router): null/undefined routerLink should disable navigation (#43087)
The current behavior of `routerLink` for `null` and `undefined` inputs is to treat
the input the same as `[]`. This creates several unresolvable issues with
correctly disabling the links because `commands = []` does _not_ behave the same
as disabling a link. Instead, it navigates to the current page, but will also
clear any fragment and/or query params.

The new behavior of the `routerLink` input will be to completely disable navigation
for `null` and `undefined` inputs. For HTML Anchor elements, this will also mean
removing the `href` attribute.

Fixes #21457
Fixes #13980
Fixes #31154

BREAKING CHANGE:
Previously `null` and `undefined` inputs for `routerLink` were
equaivalent to empty string and there was no way to disable the link's
navigation.
In addition, the `href` is changed from a property `HostBinding()` to an
attribute binding (`HostBinding('attr.href')`). The effect of this
change is that `DebugElement.properties['href']` will now return the
`href` value returned by the native element which will be the full URL
rather than the internal value of the `RouterLink` `href` property.

PR Close #43087
2021-08-20 12:51:09 -07:00
..
global build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
schematics feat(core): Add migration to update empty routerLinks in templates (#43176) 2021-08-19 11:24:12 -07:00
src fix(core): add pure annotations to static property initializers (#43064) 2021-08-16 17:20:20 -07:00
test fix(router): null/undefined routerLink should disable navigation (#43087) 2021-08-20 12:51:09 -07:00
testing fix(core): associate the NgModule scope for an overridden component (#42817) 2021-07-13 15:59:28 -07:00
BUILD.bazel build: wire up new CLDR generation tool within Bazel (#42230) 2021-07-16 12:44:59 -07:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
package.json refactor(core): update peerDependencies to allow rxjs7 (#42991) 2021-08-02 13:55:01 -07:00
PACKAGE.md docs: add package doc files (#26047) 2018-10-05 15:42:14 -07:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00