My Analysis
I set a breakpoint in function generateUrlPart in file Spartacus-core.js:
For every path stored in routeConfig.paths, this function evaluates if route parameter passed by developers in can match ALL.
Since I only specify “code” in my custom component template html,
The evaulation will fail of course, as no counterpart exists for another parameter “name” :
solution
After I add the other necessary route parameter nameForUrl: ‘Jerry’ in my html:
this time function generateUrlPart can return the expected result:
This time route works since the static url is generated successfully and contained in the rendered html.
For more of Jerry’s original articles, please follow the public account “Wang Zixi “: