【发布时间】:2019-10-23 23:39:56
【问题描述】:
我正在使用queryParams 在我的网址中包含搜索参数。然后我有以下内容:
app.routing.module.ts
{path: 'buscar', component: BuscarComponent}
组件.ts
goSearch() {
this.router.navigate(['/buscar'], { queryParams: { query: 'larapa' }} );
}
component.html
<button (click)="goSearch()">myLink</button>
然后我得到http://localhost:4200/buscar?query=larapa 的结果,但立即?query=larapa 消失,作为最终结果我得到http://localhost:4200/buscar
这是正常行为吗?我有什么错误设置吗?我该如何解决这个问题?
【问题讨论】: