[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}.

posted @ 2020-02-16 23:11  Zhentiw  阅读(97)  评论(0)    收藏  举报