Imagine being on the current URL of
http://localhost:4200/#/transactions/overview/5?tab=2
and then navigating to http://localhost:4200/#/deals/detail/
If I refresh the deals/detail page, I want to return to the previous URL which could be something like
http://localhost:4200/#/transactions/overview/5?tab=2
.
How can we achieve this in Angular? Thank you for any help and suggestions.
#Code snippet for navigating to deals/detail page
editDeal(deal:any){
let dealType = '';
const state = {
data: {
transaction: this.transaction,
},
}
this.gotoDealDetails(state);
}
gotoDealDetails(state:any){
this.route.navigateByUrl(`deals/detail/`, {state: state});
}
#Detail details page component
export class DealDetailsComponent implements OnInit {
dealDetails = null;
leaseDetails = null;
currentRentSchedule = [];
isInEditMode = false;
fiscalYear = null;
pmrType = null;
partnerType: any;
constructor(
private _route: Router,
private _dealService: DealService,
private dialog: MatDialog,
private _notificationService: NotificationService) {
this.urlData = this._route.getCurrentNavigation().extras.state.data
}
ngOnInit(): void {
}
ngAfterViewInit() {
}
}