title: Ace-editor not working on other pages - AngularJS App
body: <p>I am trying to use ACE Editor to display code (JSON response) on a page. When I try the ace example on the landing page, <code>index.html</code>, it works. But when I use the same code on <code>page2.html</code> it wont work.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div id="editor"&gt;
    function foo(items) {
     var i;
     for (i = 0; i &amp;lt; items.length; i++) {
       alert("Ace Rocks " + items[i]);
     };
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>SCRIPT:</strong> the same code works on index.html but wont work when placed on other pages.</p>
  
  <pre><code>var editor = ace.edit("editor");
  editor.setTheme("ace/theme/twilight");
  editor.getSession().setMode("ace/mode/javascript");
  </code></pre>
  
  <p>I even tried putting the above js code on an external file <code>&lt;script src-"js/script,js"&gt;&lt;/script&gt;</code> with hopes it will be available on any page.</p>
  
  <p>Since its an AngularJS App, <code>page2.html</code> and other pages are loaded via <code>ngView</code></p>