Reputation: 7609
I would like to add a path to the url, without redirecting the page.
like I am on page /home/ I want to move to /home/item1 without triggering a redirection.
I found many example on stack, but none of them work in angular 7.
location.go or location.replaceState are not available from
constructor(private location: Location) { }
I am trying to find a way in angular 7.
Upvotes: 5
Views: 7344
Reputation: 106
Other solutions here : Angular2: unable to navigate to url using location.go(url)
Using:
import {Location} from '@angular/common';
constructor(private location: Location){}
location.go('myurl');
works for me :)
Upvotes: 6