Repository: angular
Issue: LocationUpgradeModule throws Unhandled Navigation Error on initialisation when useHash is set to true
Labels: type: bug/fix,area: common,freq1: low,area: upgrade,state: confirmed,P3

<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅

Oh hi there! 😄

To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.

🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->


# 🐞 bug report

### Affected Package
<!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->
<!-- ✍️edit: --> The issue is caused by package @angular/common/upgrade


### Is this a regression?

<!-- Did this behavior use to work in the previous version? -->
<!-- ✍️--> No, the feature on which this was built was introduced in Angular 8

### Description

When `useHash` is set to `true` using the newly introduced `LocationUpgradeModule`, Angular routing fails to initialise.  This appears to be caused by the private `$$parse` method in `location_shim.ts`, which is being called with urls containing an unexpected `#` prefix (the current code only checks for a `/` prefix

## 🔬 Minimal Reproduction
<!--
Please create and share minimal reproduction of the issue starting with this template: https://stackblitz.com/fork/angular-issue-repro2
-->
[https://angular-issue-repro2-3bkm6g.stackblitz.io](https://angular-issue-repro2-3bkm6g.stackblitz.io)

<!--
If StackBlitz is not suitable for reproduction of your issue, please create a minimal GitHub repository with the reproduction of the issue.
A good way to make a minimal reproduction is to create a new app via `ng new repro-app` and add the minimum possible code to show the problem. 
Share the link to the repo below along with step-by-step instructions to reproduce the problem, as well as expected and actual behavior.

Issues that don't have enough info and can't be reproduced will be closed.

You can read more about issue submission guidelines here: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-submitting-an-issue
-->

## 🔥 Exception or Error
The initial console error is:
<pre><code>
Unhandled Navigation Error:
</code></pre>
Using the debugger to drill down into the code to reveal the actual error:
<pre><code>
Invalid url "#/", missing path prefix "https://angular-issue-repro2-3bkm6g.stackblitz.io/".
</code></pre>


## 🌍  Your Environment

**Angular Version:**
<pre><code>
Angular CLI: 8.1.2
Node: 10.15.0
OS: darwin x64
Angular: 8.1.3
... common, compiler, compiler-cli, core, language-service
... platform-browser, platform-browser-dynamic, router, upgrade

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.2
@angular-devkit/build-angular     0.801.2
@angular-devkit/build-optimizer   0.801.2
@angular-devkit/build-webpack     0.801.2
@angular-devkit/core              8.1.2
@angular-devkit/schematics        8.1.2
@angular/cli                      8.1.2
@ngtools/webpack                  8.1.2
@schematics/angular               8.1.2
@schematics/update                0.801.2
rxjs                              6.4.0
typescript                        3.4.5
webpack                           4.35.2
</code></pre>

**Anything else relevant?**
<!-- ✍️Is this a browser specific issue? If so, please specify the browser and version. -->

<!-- ✍️Do any of these matter: operating system, IDE, package manager, HTTP server, ...? If so, please mention it below. -->