0

How to encode the URL query params in Angular. For example I am passing one query params as some URL as below.

http://localhost:8080/homecontroller?siteurl=http://example.com?name=test name&[email protected]

Due that URL Param(siteurl) URL got broken. How to encode with some library without manual encoding?

1 Answer 1

1

Use queryParams

let params = {
  siteUrl: 'http://example.com?name=test name&[email protected]'
};

this.router.navigate(['/homecontroller'], { queryParams: params });
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.