title: Programmatically add ngRoute to AngularJS webpage
body: <p>I am trying to create a Chrome extension for my school's Online Learning Platform. This website uses <em>HashLocationStrategy</em>, with multiple 'pages'.</p>
  <p>I want to add custom <code>ngRoutes</code> to the page, so whenever it goes to the following URL: <code>&quot;.../magister/#/plus&quot;</code> it load my custom template into the <code>ng-view</code> component. I have tried the following script:</p>
  <pre class="lang-js prettyprint-override"><code>angular.module(&quot;MagisterPlusRouting&quot;, [&quot;ngRoute&quot;])
      .controller(&quot;RootController&quot;, ($scope, $route, $routeParams, $location) =&gt; {
          $scope.$route = $route;
          $scope.$location = $location;
          $scope.$routeParams = $routeParams;
      })
      .controller(&quot;PageController&quot;, ($scope, $routeParams) =&gt; {
  
      })
      .config(($routeProvider, $locationProvider) =&gt; {
          $routeProvider.when(&quot;/plus&quot;, {
              templateUrl: &quot;index.html&quot;,
              controller: &quot;PageController&quot;,
          });
  
          $locationProvider.html5Mode(true);
      });
  </code></pre>
  <p>But that does not seem to work, I get the following message in my console <code>routechange undefined 0</code>, this originates from the website's official script.</p>
  <p>Is it even possible to do this? How do I add these new routes? If you need further information, tell me. Although I do not have access to the development source code of the website.</p>