Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

572
Views
Change url without redirect in Angular 2

In my Angular 2 web application I would like to change the url page in the browser. For example I'd like to change it from:

http://localhost:63000/my-page

to

http://localhost:63000/your-page

It must not redirect, no page load, and browser history must reflect the page change.

Can this be done?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This can be achieved by below function available in angular 4

location.replaceState(path: string, query?: string): void;

Before doing this you need to get location object by injecting in your component or directive constructor.

  constructor(private location: Location)

And importing Location class like this -

import { Location } from '@angular/common';
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!