Skip to content

Instantly share code, notes, and snippets.

View wallin's full-sized avatar

Sebastian Wallin wallin

View GitHub Profile
@wallin
wallin / http_text_response.coffee
Created October 9, 2013 08:43
Getting raw text response from Angular JS $http
# If you have an API that returns JSON but want the reponse as raw text you
# can override Angulars built in JSON response parser by using an identity
# function as response transformer function
$http.get("/myapi",
{ transformResponse: (d, h) -> return d } # return raw response
)
.success((data, status, headers) ->
# data is now pure text
alert("Response is text: #{angular.isString(data)}")