5

I have few routes in my application. Parent route admin has few other child routes like posts, about-me, categories. I want to be able to access the child route and navigate back if the user wants to. I was trying to add a link

<a class="pointer" [routerLink]="['admin']">Back</a>

but, the Router was just adding this link to ActivatedRoute (so the url looked like: http://localhost/admin/posts/admin).

So my question is what's the correct way to navigate back from the child route? Thank you in advance.

Dawid Zbiński
  • 5,521
  • 8
  • 43
  • 70
  • http://stackoverflow.com/questions/37196882/angular-2-routing-how-do-i-navigate-to-a-parent-route-from-a-child-route – micronyks Sep 08 '16 at 15:43

1 Answers1

7

I guess you wanted to redirect back to parent.

[routerLink]="['../../parent']"
Pankaj Parkar
  • 134,766
  • 23
  • 234
  • 299