title: call normal javascript using angualrjs
body: <p>I'm trying to include legacy javascript code for affiliate tracking into an angularjs app</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          //&lt;![CDATA[ 
  
          /*** Do not change ***/
          var AWIN = {};
          AWIN.Tracking = {};
          AWIN.Tracking.Sale = {};
  
          /*** Set your transaction parameters ***/
          AWIN.Tracking.Sale.amount = '{{order_total}}';
          AWIN.Tracking.Sale.orderRef = '{(order_id}}';
          AWIN.Tracking.Sale.parts = '{{cats}}';
          AWIN.Tracking.Sale.voucher = '';
          AWIN.Tracking.Sale.currency = 'GBP';
          AWIN.Tracking.Sale.test = '0';
          AWIN.Tracking.Sale.channel = 'aw';
          //]]&gt;
      &lt;/script&gt;
  </code></pre>
  
  <p>I need to call the above code (filling in the place holders with angualr vars) and then call this:</p>
  
  <pre><code>    &lt;script src="https://www.dwin1.com/xxxx.js" type="text/javascript" defer="defer"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>What is the best way to do this? I've tried placing the code into an Angular function with no success I've also tried passing the vars down into $window and trying to insert them into the CDATA at my end with no success. Any ideas?</p>
  
  <hr>
  
  <p>I should add this code sits in a HTML page wrapped in an angualrjs controller</p>