title: How to access AngularJS variable from template script
body: <p>My controller:</p>
  
  <pre><code>$scope.totals = totals;
  </code></pre>
  
  <p>My template (works as expected for html injection):</p>
  
  <pre><code>{{totals}}
  </code></pre>
  
  <p>But what I need is to access the variable <code>totals</code> in a script in the template, like so:</p>
  
  <pre><code>&lt;script&gt;
    var totals = ????;
    // do stuff with totals
  &lt;/script&gt;
  </code></pre>
  
  <p>I've tried <code>$scope.totals</code>, <code>$totals</code>, <code>{{totals}}</code>, etc, with no avail. I would appreciate any insight, thanks!</p>
  
  <p>EDIT:</p>
  
  <p>The following is a jsfiddle of my controller and template. Inside of the template I'm wanting to insert a script that uses the <code>$scope.totals</code> variable.</p>
  
  <p><a href="http://jsfiddle.net/38CrC/" rel="noreferrer">http://jsfiddle.net/38CrC/</a></p>