I am using queryParams
to include search parameters in my url. Then I have the following:
app.routing.module.ts
{path: 'buscar', component: BuscarComponent}
component.ts
goSearch() {
this.router.navigate(['/buscar'], { queryParams: { query: 'larapa' }} );
}
component.html
<button (click)="goSearch()">myLink</button>
Then the result I get http://localhost:4200/buscar?query=larapa
but instantly ?query=larapa
disappears and as a final result I get http://localhost:4200/buscar
Is this normal behavior? Do I have something wrong set up? How can I do this to solve this?