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.
calc_total: (line) ->
that = this
$http.get("/item/get_cost?costing_id=" + line.costing_id).then (
(response) ->
# If successful set the cost per unit cents
line.cost_cents = response.data['cost_cents']
that.accumulated_balance(line) # Update balance
)
What is the correct way of doing this?