if I need to build a URL to another page in the app, say in a grid (ag-grid in my case), what’s the proper way to do this?
I have some notes like this:
router.navigateByUrl(‘/manageBlogPosts/blogPost.id/’ + $event.id)
but can’t seem to get it to work…
In my specific case, I’m trying to go to the app url /places/
I also see something called routeFunction in the Table of Apex Dynamic components library, but am a bit clueless
perhaps something like this?
buildUrl(path: string[], queryParams?: { [key: string]: any }): string {
const urlTree = this.router.createUrlTree(path, { queryParams });
return this.router.serializeUrl(urlTree);
If you mean a url with both path parameters and query parameters, you would do something like this:
this.router.navigate(['/places',place.id], { queryParams: { category: 'restaurants' } });
If you are trying to use that on an anchor tag, you can do things like this:
<a routerLink="/places/{{place.id}}" [queryParams]="{ category: 'restaurants' }">
View Place
</a>
