0

I am trying to pass a string as a url parameter, specifically as param1 in my URL. Here is the router code in my AngularJS code

.when('/test/:param1?/:param2?', {
    templateUrl: 'components/test/testPage.html',
    controller: 'TestPageController'
 })

I am looking to pass the following string to the testPage.html page

KEY WEST / Florida(FL)

I have tried several kinds of encodings as suggested in my previous question here

Encoding all the special characters in Javascript

param1 = encodeURIComponent("KEY WEST / Florida(FL)")
"KEY%20WEST%20%2F%20Florida(FL)"

param1 = escape("KEY WEST / Florida(FL)")
"KEY%20WEST%20/%20Florida%28FL%29"

But no matter what I do, I get a HTTP 404 Page not Found. I understand that the second approach may not work because the escaped string also has a / in it so maybe I should use the first approach but even that doesn't work. Is there a limit on the number of characters on the URL parameter that I am not aware of?

4
  • have you tried to escape reserved characters like this? encodeURIComponent("KEY WEST \\/ Florida(FL)") "KEY%20WEST%20%5C%2F%20Florida(FL)" Commented Nov 12, 2020 at 9:01
  • Yes and that did not work. Commented Nov 12, 2020 at 14:41
  • Is there a reason you aren’t using query strings for this? Commented Nov 13, 2020 at 1:21
  • The strings are not big enough to be using a post so just using GETs with query strings. Commented Nov 13, 2020 at 15:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.