Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
You need to add a RouterModule to app.module.ts, like here , and you can add links in the template:
<a routerLink="/"
[queryParams]="{ userId: '123' }">
Users
</a>
<a routerLink="/userId/123"
queryParamsHandling="merge">
Users
</a>
import {Router} from "@angular/router";
@Component()
export class AppComponent implements OnInit {
constructor(
private router: Router
){}
ngOnInit() {
this.router.navigateByUrl("/userId/123");
// или
this.router.navigateByUrl({queryParams: {userId: 123}});
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question