I'm trying to update the URL param value without page refresh while clicking the table row item using "location.go"
. Unfortunately I'm getting the error like "Property 'go' does not exist on type 'Location'"
Expert advise please?
Actual URL: http://localhost:4200/technicalSettings/disciplines
Expected URL without page refresh on row click: http://localhost:4200/technicalSettings/disciplines/1109
Version: Angular 7
import { Location, LocationStrategy, PathLocationStrategy} from "@angular/common";
onRowClicked(event: any) {
this.isRowSelected = true;
this.selectedId = event.id;
this.selectedItem = event;
this.dataService.set(event);
location.go("technicalSettings/disciplines", this.selectedId);
//this.router.navigate(["technicalSettings/disciplines", this.selectedId]);
}
As location service is part of angular common module. Add below import statement in your component class
import { Location } from '@angular/common';
otherwise it refer to window/document Location property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With