title: AngularJS accessing 'this' within a $http
body: <p>Within my AngularJS service I'm trying to call method within the same file within a $http success block and I have to use 'that = this' so I can access it properly. </p>
  
  <pre><code>calc_total: (line) -&gt;
    that = this
    $http.get("/item/get_cost?costing_id=" + line.costing_id).then (
      (response) -&gt;
        # If successful set the cost per unit cents
        line.cost_cents = response.data['cost_cents']
        that.accumulated_balance(line) # Update balance
    )
  </code></pre>
  
  <p>What is the correct way of doing this?</p>