【发布时间】:2022-04-20 19:14:31
【问题描述】:
注意:我知道该主题看起来与其他问题相似,但有所不同
我有调用 Google API (gapi) 的 Angular 应用程序。
我有调用 gmail api、calendar api 和 youtube api 的函数。
这里我有两个问题:
问题1:为什么youtube在这里无法识别? 虽然我已经安装了所有类型:
问题2:运行应用时,gmail api和calendar api调用正常,但是youtube api调用抛出youtube未定义的错误?
getMessages() {
return gapi.client.gmail.users.messages.list({ userId: 'me', labelIds: ['INBOX', 'UNREAD'] }).then();
}
getEvents() {
return gapi.client.calendar.calendarList.list().then();
}
getChannels() {
return gapi.client.youtube.channels.list({'part': 'snippet', 'mine': 'true'}).then();
}
由于某些原因在 getChannels() 函数中出现错误
Uncaught TypeError: Cannot read property 'channels' of **undefined**
其中 gapi.client.youtube 未定义。
gapi 已定义,客户端也已定义,但 youtube 未定义。
感谢任何帮助。如您所见,这些api的调用方式没有区别,相同的签名,不明白为什么youtube未定义。
这是调试模式下的截图
【问题讨论】:
-
这能回答你的问题吗? gapi.client.youtube is undefined?
-
很遗憾没有
标签: angular google-api-js-client