Background:
I have recently published my angular project on namecheap hosting. Due to routing issues, I have enabled useHash = true while exporting my app-routing.ts file.
export const appRoutingModule = RouterModule.forRoot(routes,{ enableTracing: false, useHash: true});
Since, my routing issues resolved, however in all my URL's I got #.
Issue:
At one point in my code, I access the URL and analyze the URL, if there is already a search query parameter I append the new one with & symbol or if there is not then I add the search query with ? sign.
        var uid = this.route.snapshot;
        var searchURL = "";
        
     
        alert("Checking search:: " + window.location.search); // returns empty
        alert("One more time:: " + new URLSearchParams(location.search)); // returns empty 
        if (new URL(window.location.href).search == "")
        {
          searchURL = "?"+incomingSearch;
        }
        else 
        {
          searchURL = new URL(window.location.href).search + "&" + incomingSearch;
        }
       
        this.location.replaceState( uid.routeConfig.path+ searchURL);
If my url is like
http://localhost:4200/#/women?occasion=cozy
The window.location.search returns empty
If I remove # from my URL I received the data
http://localhost:4200/women?occasion=cozy
The window.location.search returns '?occasion=cozy'
Any help is appreciated. I have looked at this question as well but $window.location.search gives error though I have installed jquery.
 
    