我正在尝试在不刷新页面的情况下更新 URL 参数值,同时使用"location.go". 不幸的是,我收到了这样的错误"Property 'go' does not exist on type 'Location'"
请高手指教?
实际 URL:http://localhost:4200/technicalSettings/disciplines
在行点击时没有页面刷新的预期 URL:http://localhost:4200/technicalSettings/disciplines/1109
版本: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]);
}
Run Code Online (Sandbox Code Playgroud)
小智 10
由于位置服务是 angular 通用模块的一部分。在组件类中添加以下导入语句
import { Location } from '@angular/common';
Run Code Online (Sandbox Code Playgroud)
否则它指的是窗口/文档位置属性。
| 归档时间: |
|
| 查看次数: |
3699 次 |
| 最近记录: |