search

Home  >  Q&A  >  body text

angular.js - After packaging the project with angular2-cli, a 404 error will be reported when refreshing the jump route

After the Aangular2 project is packaged using the ng build command under anguar2-cli, run the static index.html file in the dist folder. There is no problem with the first route jump, but if the page is refreshed in the jumped route, A 404 error will be returned.

GitHub code link: https://github.com/borysn/spr...

After clicking register on the main page, it will jump to the registration page normally. However, if you refresh the registration page, 404 will be returned

I don’t know if anyone else has encountered this situation. If so, please let me know the solution.

天蓬老师天蓬老师2819 days ago683

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-05-15 17:12:28

    Adding {useHash:true} in the route can solve this problem

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-15 17:12:28

    Same question, I am also looking for this problem

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-15 17:12:28

    You can use Nginx to do a layer of routing transfer, first jump to the homepage, and then use the routing strategy to perform related rendering

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-15 17:12:28

    Whether dynamic parameters are set for the route? If so, this problem may occur. I am also working on solving it

    reply
    0
  • Cancelreply