CoffeeScript - 显示 HTTP 错误状态代码

CoffeeScript - Show HTTP error status codes

所以我一直在努力弄清楚如何识别与 CoffeeScript 中的 http get 错误响应关联的错误代码。

这是我正在使用的函数

$scope.someRandomFunction = ->
    url  = $config.serverAddress + 'methodOnTheServer'
    url += '?someParameter=' + someParameter.ID
    $http.get(url)
    .success (tempFileName) ->
        link  = $config.serverAddress + 'anotherServerMethod'
        link += '?tempFileName=' + tempFileName
        link += '&desiredFilename=' + someParameter.Name
        $window.location.href = link
    .error (error) ->
        console.log "Unable to perform this action ", error

这是一些网站的列表和我尝试过的此表单上的以前答案:

http://www.ibm.com/developerworks/library/wa-coffee4/

感谢您的宝贵时间

在Angular中获取http状态码,add another parameter to the callback.

$http.get(url)
  .success (tempFileName, status) ->
     console.log(status)