How to reload current route in Angular using Router
Hello everyone! I'm new to Angular and TypeScript, and I've encountered this problem: I need to programmatically reload the current page (same route, same parameters). For example, after a user has saved or changed data, I want to refresh the component so it reloads data from the server again.\n\nI tried using `location.reload()`, but that completely reloads the page, which resets the application state and looks ugly. I also tried `this.router.navigate([this.router.url])`, but Angular doesn't respond — nothing happens because the route hasn't changed.\n\nHere's an example of the code I'm trying to use:\n\n```typescript\nimport { Component } from '@angular/core';\nimport { Router } from '@angular/router';\n\n@Component({\n selector: 'app-my-page',\n tem
No answers yet.
Log in to leave an answer