我有一个angularjs应用程序,在这里我可以看到我调用服务器的函数正在返回结果。但是当我尝试记录结果时,它说它是未定义的,我不知道如何...
功能如下:
checkUser: function(vcard){
console.log('Login: ' + vcard.login + ' password: ' + vcard.password);
AuthService.login({'password':vcard.password, 'login':vcard.login}).then(function(result){
console.log('result alone: ', result);
})
}
这是有效载荷(更改了JWT):
{"success":true,"token":"JWT eyJ0eXAiOiJKV1QJhbGciOiJIUzI1NiJ9.eyJfaWQiOiI1Y2IyOTg3NWIyZGI2YTRlMjc4MGY3OTQiLCJsb2dpbiI6ImNuYWtlYSIsInBhc3N3b3JkIjoiJDJiJDEwJEJwNi5Ed2VHWldjN0Fvc1pBQmJVRXVRc0ZscWtvaXVreE9halRkT2RRbmJKaVBaOEJsd202IiwiZW1haWwiOiJjaHJpc0BjaHJpc25ha2VhLmNvbSIsImNvpcm1hdGlvbl9jb2RlIjoiZWZhYTI4YjItNjlhZi00OTBmLWQ0N2UtODA2ZDcwNDkyNzJkIiwiY29uZmlyV9leHBpcmUiOiIyMDE5LTA0LTE1VDAyOjE4OjI5LjMxNloiLCJfX3YiOjAsImNvbmZpcm1lZCI6ZX0.7a24lP5h7Uq1kUL5JFGF2bUEdJ9VNDAqS13Y8NQQmmI","userId":"5cb29875b2db6a4e80f794"}
您会看到结果。不应该“结果”显示结果。为什么会出现“未定义”的字样?