AngularJs Routing without hashtag in link?

前端 未结 3 390
无人及你
无人及你 2021-01-27 16:20

I\'ve recently began learning AngularJs for web development and am loving it so far. However, I\'m not so sure about having hashtags withing the link when routing between views.

3条回答
  •  隐瞒了意图╮
    2021-01-27 16:47

    When I remove the hashtag, the reload the page and gets 404 error

    That's because in your server side code you are probably not handling a request like "www.sampledomain.com/orders/450"

    You can have your server-side code handle this request by either returning a redirect to the new URL ("www.sampledomain.com/#/orders/450") or just return the correct HTML directly. The "right" solution will depend on your needs.

提交回复
热议问题