1

I'm using the Angular version 12 I want to send the following object in query params:

{
  dynamicQueryOperators: 6&dynamicQueryOperators=8
}

But in the end, the URL that is sent to the server is like this Request URL:

...dynamicQueryOperators=6**%26**dynamicQueryOperators=8

How can I prevent "&" from changing to "%26"?

2
  • 1
    I'm no angular master, but maybe you could just throw a decodeURIComponent at the other end. for example decodeURIComponent("you %26 me") == 'you & me' Commented May 6, 2022 at 15:52
  • If you don't let it be encoded it will be treated as the start of a new query parameter. Commented May 6, 2022 at 16:00

1 Answer 1

1

I was able to fix the bug by sending the variable as an array. If you send the variable like below:

this.query['dynamicQueryOperators'] = [6, 8];

Your header will be automatically created with two identical object keys and the character "&" will be placed between them.

Sign up to request clarification or add additional context in comments.

Comments

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.