diff --git a/src/app/modules/map/page/map-page.component.ts b/src/app/modules/map/page/map-page.component.ts index 967b4992..378a92f8 100644 --- a/src/app/modules/map/page/map-page.component.ts +++ b/src/app/modules/map/page/map-page.component.ts @@ -438,7 +438,7 @@ export class MapPageComponent { this.distance = this.positionService.getDistance(this.items[0].geo.point); this.addToMap(this.items, true); this.ref.detectChanges(); - const url = this.router.createUrlTree(['/map/', uid]).toString(); + const url = this.router.createUrlTree([[], uid]).toString(); this.location.go(url); // center the selected place this.focus(geoJSON(this.items[0].geo.point).getBounds().getCenter()); diff --git a/src/app/modules/schedule/page/schedule-page.component.ts b/src/app/modules/schedule/page/schedule-page.component.ts index aaaed5c7..d128e406 100644 --- a/src/app/modules/schedule/page/schedule-page.component.ts +++ b/src/app/modules/schedule/page/schedule-page.component.ts @@ -19,9 +19,9 @@ import { OnInit, ViewChild, } from '@angular/core'; -import {ActivatedRoute} from '@angular/router'; +import {Location} from '@angular/common'; +import {ActivatedRoute, Router} from '@angular/router'; import {AnimationController, ModalController} from '@ionic/angular'; -import {last} from 'lodash-es'; import {SharedAxisChoreographer} from '../../../animation/animation-choreographer'; import {materialSharedAxisX} from '../../../animation/material-motion'; import {ModalEventCreatorComponent} from './modal/modal-event-creator.component'; @@ -136,6 +136,8 @@ export class SchedulePageComponent implements OnInit, AfterViewInit { private readonly modalController: ModalController, private readonly activatedRoute: ActivatedRoute, private readonly animationController: AnimationController, + private router: Router, + private location: Location, ) {} ngOnInit() { @@ -172,13 +174,10 @@ export class SchedulePageComponent implements OnInit, AfterViewInit { * When the segment changes */ onSegmentChange() { - window.history.replaceState( - {}, - '', - `/#/schedule/${this.segmentView.value}/${last( - window.location.href.split('/'), - )}`, - ); + const url = this.router + .createUrlTree([[], this.segmentView.value]) + .toString(); + this.location.go(url); this.tabChoreographer.changeViewForState(this.segmentView.value); }