[Angular] Do relative routing inside component

onSave(personName) {
    this.person.name = personName;
    this.peopleService.save(this.person).subscribe(() => {
      // redirect back people list
      // this.router.navigateByUrl('/people');
      this.router.navigate(['../'], { relativeTo: this.activatedRoute });
    });
  }

We need to add {relativeTo: xxx}.

猜你喜欢

转载自www.cnblogs.com/Answer1215/p/12319381.html