fix: links of timetable tabs

Closes #144
This commit is contained in:
Jovan Krunić
2021-11-08 21:05:34 +01:00
committed by Rainer Killinger
parent 1c56c891e1
commit 837c69bb21
2 changed files with 9 additions and 10 deletions

View File

@@ -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());

View File

@@ -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);
}