0

I am using angular 15.0 for my project. There are two shared paths in routing-module. for example: The first path: is: '../customer/:customerId/showInvoice/:invoiceId' And the second path is: '../customer/:customerId/newInvoice/:customerId'. When we have followed the second path to the end, so that a new invoice is saved, so far, we have retrieved the invoice ID from the database and we have it. For example: ../customer/3/newInvoice/3 and the retrieved invoiceId is 15. So, now we want to back one path with new parameter (i.e. we switch on the first path to show the new invoice which has created), i.e. ../customer/3/showInvoice/15. Is this scenario possible? If so, what method can be used? Is it possible to use Angular LocalStrategy service? and how? I will be grateful if you provide a suitable solution. Best regards.

4
  • stackoverflow.com/questions/38131293/angular-2-router-navigate does this anwswer your question? Commented Jan 6, 2023 at 20:51
  • Does the answer in the link you sent mean that the following statement works for my question? this.router.navigate(['../showInvoice', invoiceId] Commented Jan 7, 2023 at 4:17
  • Or this: this.route.navigate['../showInvoice', invoiceId, relativeTo: this.currentActivatedRoute] Commented Jan 7, 2023 at 4:30
  • Try this.router.navigate(['customer', '3', 'showInvoice', invoiceId]); I have not tested this one. Of course you can pass the customer id as parameter as well like invoiceId. Commented Jan 7, 2023 at 18:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.