I've created two Components one for list, other for details.
Created two routes in main.routing.module.ts
{ path: 'finishedGoods/truck-packing', component: DeliveryPlanningListComponent },
{ path: 'finishedGoods/truck-packing-details/:id', component: PackingDetailsComponent },
Then in PackagingDetailsComponent html i created a button with route
<button routerLink = "/finishedGoods/truck-packing-details/{{record.deliveryNote.id}}">test</button>
I get an error : Error: Cannot match any routes. URL Segment: 'finishedGoods/truck-packing-details/2'
When I write the link in browser it works, so the route is working but its not generated correctly with routerLink directive in html component.
Also when I add app/main to link
<button routerLink = "/app/main/finishedGoods/truckPackingDetails/{{record.deliveryNote.id}}">test</button>
Then it is working, how should I resolve this ?
3 Answer(s)
-
0
I do not understand what is your problem exactly. Just prefix "/app/main" and that's it. Before "/app" is "base URL". It's also good to have ability to change module (we do not implement application inside "main" but inside our custom Angular modules".
-
0
It should work with:
[routerLink]="['/finishedGoods/truck-packing-details', record.deliveryNote.id]"
But it throws error: Error: Cannot match any routes. URL Segment: 'finishedGoods/truckPackingDetails/2'
Why do I need to add "app/main" in front of it ?
-
0
Hi,
The
app/main/
is needed as the routes are added tomain.routing.module.ts
which is a child route ofapp.routing.module.ts
androot.routing.module.ts
.