Skip to content

Commit

Permalink
[Angular] *scRouterLink breaks link generation (#815)
Browse files Browse the repository at this point in the history
* Strip querystring params from ScRouterLink href

* Update tests for router-link

* Use navigateByUrl instead
  • Loading branch information
CobyPear committed Sep 16, 2021
1 parent d509fc5 commit c75d0de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ describe('<a *scRouterLink />', () => {
fixture.detectChanges();

const rendered = de.query(By.css('a'));
expect(rendered.nativeElement.href).toContain(field.value.href);
expect(rendered.nativeElement.className).toContain(field.value.class);
expect(rendered.nativeElement.title).toContain(field.value.title);
expect(rendered.nativeElement.target).toContain(field.value.target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class RouterLinkDirective extends LinkDirective {

if (key === 'href') {
this.renderer.listen(node, 'click', (event) => {
this.router.navigate([propValue]);
this.router.navigateByUrl(propValue);
event.preventDefault();
});
}
Expand Down

0 comments on commit c75d0de

Please sign in to comment.