Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular: Property 'go' does not exist on type 'Location'

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]);
  }
like image 927
klmuralimohan Avatar asked Jun 03 '19 08:06

klmuralimohan


1 Answers

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.

like image 175
Akhil Jadhav Avatar answered Oct 13 '22 02:10

Akhil Jadhav