1

I have an angular 4 application with router-link and it works fine. My root is localhost:4000. when I click on routerlink it will take me to something like localhost:4000/cts and everything works fine as expected. My problem is, if my user bookmark the localhost:4000, they can return to it. If they bookmark after the click on anything on the routerlink, it will saved as localhost:4000/cts rather than just the localhost:4000 which will load the index page. When they come back with localhost:4000/cts, i get a cannot get Cannot GET /cts.

How do I configure the app so that it will load correctly?

here is my routes.

const ROUTES : Routes = [

  {path: '',component: ShopFloorStopLight},
  {path: 'cts',component: CTS  },
  {path: 'scurve',component:SCurve}

]
Thaison Nguyen
  • 131
  • 1
  • 10
  • It is because every time you go something other than the root `/` (`/cts` in you case), the server does not know what to send in response because there is no matching route. You may need to configure the server to send the index page in case of 404s – Sachin Gupta Jan 09 '19 at 18:32
  • It is likely that you have a parsing issue or some kind of error when you load /cts without going through your base path. Base component might be initializing something that /cts is dependent on? – Aragorn Jan 09 '19 at 19:08
  • should be anytime i got to localhost/xxx should refer be back to localhost:4000 – Thaison Nguyen Jan 09 '19 at 23:01

0 Answers0