0

My angular 4 application implements routing, one of my path is detail/:code. But my code isn't a simply number, is a partial string path like this /user/4 It works well when I navigate appending this code to my principal endpoint but when I land into this detail page if I look into my url bar I found this path

http://localhost:4200/dashboard/user-detail/%2Fusers%2F2

It use escape %2 for my '/', I can't change my code into a number, is it possible to figure out the correct url?

Derek Brown
  • 4,232
  • 4
  • 27
  • 44
Alessandro Celeghin
  • 4,039
  • 14
  • 49
  • 95
  • 1
    Provide please a plunker example, it seems that the url in the routerLink attribute is broken – Mike Kovetsky Jul 13 '17 at 13:57
  • @MikeKovetsky At the moment I have a selectable table, when I click on some records I do this:` this.router.navigate`(['/dashboard/user-detail', this.code]);` path in user-detail is 'user-detail/:code' – Alessandro Celeghin Jul 13 '17 at 14:09
  • 1
    Your each escape `/` is getting encoded to `%2F` since it's part of the url. See this question on how to handle that https://stackoverflow.com/questions/41476193/angular-2-disable-url-encoding – Nehal Jul 13 '17 at 14:13
  • Also, just a note, if you pass `/user/4` to route `/dashboard/user-detail`, it's going to look like `/dashboard/user-detail//user/4` – Nehal Jul 13 '17 at 14:16
  • Yes, ok so the solutions for the symbol like / is to implements a custom serializer – Alessandro Celeghin Jul 13 '17 at 14:20

0 Answers0