Hi all,
I update event Angular code to process url pattern "myeventportal.microsoftcrmportals.com/event/MyEventId". I don't want to use "?id=" in my URL.
I run successfully when I open the event home page and click on an event to jump to event detail page, but it failed when I open the event detail page directly.
I think it isn't loading the Angular page. Do you know how to fix this or have a work-around on this?
Thanks!
Hey - glad to see that you've resolved this issue. Thanks Clofly!
We've also taken this scenario and shared it with the team. If you have further questions - please don't hesitate to reach out via the forums.
Thanks,
Shravan Suri
PM, D365 Marketing
Hi Clofly,
Thank you very much for your detail feedback.
I found a work-around for this.
I am doing in a different way.
I include id into the route like this.
In the code, I modified to get the id.
But I get the error when I open the link with event id directly.
The reason is the portal cannot find the page with that name when we open the link directly. I create a child page with the partial url is the eventid, and now I can open the link successfully.
From now, with each event, I will create a child page with eventId as Partial URL and the event portal can run successfully if users open the link directly.
Thanks,
Binh
Hi truc,
The URL format "?id=" is used to pass parameters, and Angular uses its paramMap interface to get parameters after ? symbol.
That's by design, I recommed you not change this format.
Of course, you can still change format(and you've changed it), the reason for issue you encountered is that paramMap.get in event.component.ts and sessions.component.ts can't get id parameters from URL
because you had changed it from "event?id=x" to "event/x".
The format "event/x" is more likely to represent a web page instead of it's passing a parameter.
It seems that you had changed routerLink attribute of link element to href attribute, would my guess be right?
To make your URL format works, you should do following steps:(My demo is based on static readableId)
1. Add readableID as a child path to event path in routes.ts.
2. Assign readableEventId(x) to readableEventId variable in event.component.ts,
because sessiontracks, spearkers and passes will all use this value to retrieve data in event.component.ts.
3. Also, assign readableEventId(x) to readableEventId variable in event.component.ts,
because subscribeToEventChange function will be executed when sessions.component.ts onInit event.
4. By doing above steps, then you page could display in customized format.
In a word, you should write custom js code to query last pathname in customized URL instead of querying parameters.
However, the real trouble is that every path names in routes.ts are static, while readableEventId is a dynamic value,
it would be dificult to get URL pathname in routes.ts, and routes.ts will always regards event/a or event/b as a path instead of a parameter.
So my final suggestion is that you should keep origin URL format.
Regards,
Clofly
André Arnaud de Cal...
291,971
Super User 2025 Season 1
Martin Dráb
230,846
Most Valuable Professional
nmaenpaa
101,156