HashLocationStrategy should be set by default in the angular project.
Suppose you have deployed Angular code in webserver(in PRD environment). When you refresh the page after navigating to some pages(for eg., http://xyz.com/foo/bar) you will receive 404 error. The reason is Browser tries to get new content from the server, but the server does not understand this request from where to bring the content.
As Angular code gets downloaded to the browser, it should not ask the server to send new content on refreshing the page
This can be avoided by setting HashLocationStrategy in AppModule
Due to this parameter, URL will have a hash fragment(for eg., http://xyz.com#/foo/bar). This says browser to check in his local files to get new URL details instead of sending the request to the server.
Another 404 issue you can avoid using this feature is if the user tries to open an angular page in another tab/window by using right-click option.
Reference – https://angular.io/api/common/HashLocationStrategy