Search code examples
angularangular2-routing

Using email address as route parameter


I'm trying to use an email address as a route parameter. When I first click the link, the page loads fine, but when I try access the url directly I get the following error:

Cannot GET /users/edit/susannaallison%40emergent.com/

This is an example of what I'm trying to use:

http://localhost:5555/users/edit/susannaallison%40emergent.com/

I know it has to do with the . in the email, but I'm trying to find a way around that.


Solution

  • So the way I got around this was slightly "hacky".

    I replaced the . with a unique string that I made up, then inside my controller I replaced that unique string with a ..

    It's really hacky, but it was the only way around this that I could find.

    UPDATE:

    I tried this again recently and it just seemed to work with the email address in the URL, above solution isn't needed anymore I guess...