如何在CoffeeScript中的回调中使用类变量

时间:2014-09-14 00:26:49

标签: javascript angularjs coffeescript scope angular-promise

class IndexCtrl
        constructor: (@Auth) ->
            @name = 'John'

        login: ->
            @Auth.login({email: @name, password: @password}).then(
                (user)->,
                (error)->
                    console.log @name
                )

在控制台中我得到 (空字符串) 。 如何在此回调中使用我的@name?

0 个答案:

没有答案