title: Chromium + Raw Html (directly from a C# string) + Angular => Problems when attempting to use routing
body: <ul>
  <li>CefSharp: 1.25.0 (based on Chromium 25.0.1364.152)</li>
  <li>Angular: 1.3.0-beta16</li>
  <li>UIRouter: 0.2.10</li>
  </ul>
  
  <p>I'm developing a stand-alone C# application that uses CefSharp Chromium + Angular + UIRouter as the stack upon which the GUI will be relying on.</p>
  
  <p>I hit it off by trying to make the above stack load the sample-code provided here:</p>
  
  <p><a href="http://scotch.io/tutorials/javascript/angular-routing-using-ui-router" rel="nofollow">http://scotch.io/tutorials/javascript/angular-routing-using-ui-router</a></p>
  
  <ul>
  <li><p>For the sake of elegance the HTML + Javascript-libs of the GUI, get cobundled in a single resource file inside the .Net executable of the application.</p></li>
  <li><p>This resource is then passed programmatically during application-init to the Chromium control (by means of .LoadHtml) to be loaded <em>directly</em> into the browser, aka the HTML is <em>not</em> loaded from a separate .html file residing in the hard-drive or on a remote HTTP server. If the HTML gets loaded from the later ("standard") venues then everything works <em>flawlessly</em>.</p></li>
  </ul>
  
  <p>I noticed that when loading the HTML directly as a string, as described above, the url of the resulting static web page (aka window.location) is set to 'about:blank'. It appears that angular has some sort of pet peeve with such a url, especially when it comes to using routing:</p>
  
  <ul>
  <li><p>First of all, the invocation of:</p>
  
  <pre><code>history.pushState(null, "", url);
  </code></pre>
  
  <p>inside</p>
  
  <pre><code>self.url = function(url, replace) { ... }
  </code></pre>
  
  <p>throws an exception ala</p>
  
  <pre><code>Error: SecurityError: DOM Exception 18
  Error: An attempt was made to break through the security policy of the user agent.
      at Browser.self.url (about:blank:8004:21)
      at about:blank:10049:24
      at Scope.$eval (about:blank:11472:28)
      at Scope.$digest (about:blank:11381:31)
      at Scope.$apply (about:blank:11493:24)
      at about:blank:6818:15
      at Object.invoke (about:blank:7814:19)
      at doBootstrap (about:blank:6817:16)
      at bootstrap (about:blank:6827:14)
      at angularInit (about:blank:6796:7)
  </code></pre>
  
  <p>the url that is passed to .pushState is:</p>
  
  <pre><code>about:blank#/home
  </code></pre>
  
  <p>which appears to be the result of concatenating 'about:blank' with the default state '/home'.</p></li>
  <li><p>Secondly, even if the above problem is solved there appears to be a major issue inside:</p>
  
  <pre><code>$rootScope.$watch(function $locationWatch() { ... })
  </code></pre>
  
  <p>which causes the following error:</p>
  
  <pre><code>Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
  </code></pre>
  
  <p>the reason is that when 'window.location' is set to 'about:blank' then</p>
  
  <pre><code>$browser.url()
  </code></pre>
  
  <p>always returns</p>
  
  <pre><code>about:blank
  </code></pre>
  
  <p>while</p>
  
  <pre><code>$location.absUrl()
  </code></pre>
  
  <p>returns</p>
  
  <pre><code>about:blank#/home
  </code></pre>
  
  <p>causing $watch to fire non-stop.</p></li>
  </ul>
  
  <p>Is there any proper way to handle this shortcoming of angular when its dealing with web pages loaded directly into the browser in the manner described here?</p>
  
  <p>If there is no workaround for this issue then I'm afraid that I will have to resort to loading the HTML directly from a file in the hard drive, which apart from being slower (can't cache the string to memory for subsequent usages), it's also a noticable deviation from the goal of developing a stand-alone-exe. :(</p>
  
  <p>Thanks in advance and I apologize if this issue has been addressed elsewhere.</p>