我收到以下错误:TypeError: Object [object global] has no method 'setApiToken'
angular.module("userService", ["restangular", "angular-cache"]).factory "userService", (Restangular, $angularCacheFactory) ->
setCurrentUserId: (value) ->
# Code here...
login: (user, callback) ->
# FOR TESTING PURPOSES, I DON'T GET AN ERROR HERE
@setApiToken(1)
Restangular.all("sessions").post(user).then (returnVal) ->
returnJson = angular.fromJson(returnVal)
if returnJson.success is true
# I GET AN ERROR HERE ############################################
@setApiToken(returnJson.data.authToken)
returnJson.id
else
""