I wrote an Angular2 (v2.0.1) application that makes use of the router. The website is loaded with several query string parameters, so the full URL initially looks like this:
After having had a go at most answers, I found that
/ didn't do it eitherhttps://my.application.com/comp1?param=val <= ( ಠ 益ಠ )https://my.application.com/comp1;param=valSo here's yet another approach, that eventually behaved as per my expectations:
import { ActivatedRoute, Router } from '@angular/router';
class Component {
constructor(private route: ActivatedRoute, private router: Router) {}
someMethod() {
router.navigate(['/comp1', this.route.snapshot.params]);
}
}