title: Angular ng view not rendering correctly in firefox - i just get "function () { return html; }"
body: <p>I am in the middle of a reasonably size AngularJS app and our BDD's have started failing recently. It turns out that they are failing because after the first load of the site in firefox (i.e. reloading the page) causes the NG-View to render </p>
  
  <p>function () { return html; }</p>
  
  <p>the html for this is </p>
  
  <pre><code>&lt;div data-ng-view=""&gt;
      &lt;span class="ng-scope"&gt;function () { return html; }&lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I can reproduce this error in firefox easily by reloading the page but in Chrome/IE10 and IE10 in IE7 mode i can't reproduce it. </p>
  
  <p>When debugging the app is 'booting' up normally - making a few service calls to get lookup data etc, registering services, directives and loading controllers. </p>
  
  <p>When the page is in this state i can execute </p>
  
  <pre><code>angular.element($0).scope() 
  </code></pre>
  
  <p>on the console and see the scope of </p>
  
  <pre><code>&lt;html data-ng-controller="app.controller"&gt;
  </code></pre>
  
  <p>There are no errors in the console when the app is in this state, and if i set the debugger to pause on errors i get one error in jquery-min and nothing else. </p>
  
  <p>Any ideas would be greatly appreciated. I can also post code samples to particular areas like routing if required. </p>
  
  <p>*<em>EDIT *</em></p>
  
  <p>The issue was related to dynamically loading the controllers/html using some code from this google group</p>
  
  <p><a href="https://groups.google.com/forum/#!msg/angular/rs1dj097oHA/cPwPZfLvX4EJ" rel="nofollow">https://groups.google.com/forum/#!msg/angular/rs1dj097oHA/cPwPZfLvX4EJ</a></p>
  
  <p>the fix to the code can be seen in the thread. </p>
  
  <p>I haven't marked it as an answer because i feel there is a deeper issue in the way angular is treating 'routeDefinition.template' otherwise i would see either the html or the printing of the entire function ALL the time - not some seemingly random switching. </p>
  
  <pre><code>routeDefinition.template = function () {
              return html;
          };
  </code></pre>
  
  <p>cheers
  kle</p>