Open wangzixi-diablo opened 4 years ago
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":
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.
I have created a custom module with the following routing settings:
the /custom url points to my custom component with html template below:
when I click hyperlink "Awesome Product 2", I expect to navigate to the product detail page for product 300938:
Unfortunately it does not work. When I click the hyperlink, it will open http://localhost:4200/electronics-spa/en/USD instead.
I observed in Chrome development tool, that every time I open url http://localhost:4200/electronics-spa/en/USD/custom, there is warning message reported in Chrome console:
No configured path matches all its params to given object. Route config:
This just points to my route configuration hard coded in .
I am exactly following the same source code as found in training video: