From 759e172e34f77262d9ed813a56d9cc414b4beca9 Mon Sep 17 00:00:00 2001 From: Sam Baptista Date: Fri, 8 Nov 2024 18:20:41 +0100 Subject: [PATCH] fixed-button dont redirect unconditionally if we dont provide him an addresse and create action preserve query params --- projects/natural/src/lib/classes/abstract-detail.ts | 3 ++- .../src/lib/modules/fixed-button/fixed-button.component.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/natural/src/lib/classes/abstract-detail.ts b/projects/natural/src/lib/classes/abstract-detail.ts index 7a8222ff..56253005 100644 --- a/projects/natural/src/lib/classes/abstract-detail.ts +++ b/projects/natural/src/lib/classes/abstract-detail.ts @@ -220,7 +220,8 @@ export class NaturalAbstractDetail< const newUrl = oldUrl.replace('/new', '/' + model.id) + (nextUrl ? '/' + nextUrl : ''); return this.router.navigateByUrl(newUrl); // replace /new by /123 } else { - return this.router.navigate(['..', model.id], {relativeTo: this.route}); + const queryParams = this.route.snapshot.queryParams; + return this.router.navigate(['..', model.id], {relativeTo: this.route, queryParams}); } } diff --git a/projects/natural/src/lib/modules/fixed-button/fixed-button.component.ts b/projects/natural/src/lib/modules/fixed-button/fixed-button.component.ts index f43beb24..b1de2aa1 100644 --- a/projects/natural/src/lib/modules/fixed-button/fixed-button.component.ts +++ b/projects/natural/src/lib/modules/fixed-button/fixed-button.component.ts @@ -14,7 +14,7 @@ import {MatButtonModule} from '@angular/material/button'; }) export class NaturalFixedButtonComponent { @Input({required: true}) public icon!: string; - @Input() public link: RouterLink['routerLink'] = []; + @Input() public link: RouterLink['routerLink'] | null = null; @Input() public color: ThemePalette = 'accent'; @Input() public disabled = false; }