Hash Location Strategy in Angular 2

后端 未结 4 792
梦如初夏
梦如初夏 2020-12-06 18:16

I\'m trying to create an application with hash location strategy, but it does not add the hash to the url. For instance when I click on a button associated with { path: \'/p

4条回答
  •  囚心锁ツ
    2020-12-06 18:51

    It is recommended to use the HTML 5 style (PathLocationStrategy) as location strategy in Angular

    Because

    1. It produces the clean and SEO Friendly URLs that are easier for users to understand and remember.
    2. You can take advantage of the server-side rendering, which will make our application load faster, by rendering the pages in the server first before delivering it the client.

    Use Hashlocationstrtegy only if you have to support the older browsers.

    Click Here for More info

提交回复
热议问题