angularjs - 如何使用 Angular 读取公共(public)谷歌日历中的事件

标签 angularjs google-calendar-api

我有一个嵌入在我的网站中的谷歌日历,但我希望能够从日历中提取事件详细信息(日期、时间、事件描述、地址)并使用 Angular 读取它,以便我可以重新格式化它并在我的页面上以我想要的方式显示它。

我不需要与它交互(意味着更新、删除、编辑任何内容),只需从中提取事件即可。

这可以通过 Angular API(或其他调用)实现吗?

最佳答案

是的,这是可能的,因为 Google 提供了 Google Calendar API

首先,您必须使用以下链接为您的日历启用 API: Google APIs wizard

然后您可以按照 Google 本身提供的 API 引用,只需对列出的端点执行 GET/POST 请求即可。
Google calendar API reference

编辑:作者询问了一些 Angular 示例来执行 HTTP 请求。 这是执行简单 GET 请求以获取 calendarId 条目的代码示例:

$http({
  method: 'GET',
  url: 'https://www.googleapis.com/calendar/v3/users/me/calendarList/' +calendarId
}).then(function successCallback(response) {
    // this callback will be called asynchronously
    // when the response is available
  }, function errorCallback(response) {
    // called asynchronously if an error occurs
    // or server returns response with an error status.
  });

如果您问这样的问题,可能这个答案还不够,我认为这不是提供对该主题足够广泛的解释的最佳地点(而且可能我不是最好的老师) 。 看看官方Angular HTTP documentation更多示例和更完整的解释

关于angularjs - 如何使用 Angular 读取公共(public)谷歌日历中的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37391311/

相关文章:

javascript - AngularJS:自动选择单选按钮

javascript - 如何从 Greasemonkey 脚本中取消选中 HTML 页面上的所有 "md-checkboxes"(不是真正的复选框)?

javascript - 通过脚本创建新事件时覆盖现有的谷歌日历事件

php - 如何使用 Google 日历 API 的功能

c# - 谷歌 API : How do I retrieve a Calendar's Private Address or Magic Cookie

javascript - 将对象数组精炼为仅最新组

grails - 未经授权的响应上的AngularJS(1.1.5)无限循环

javascript - 动态递增整数字段 - Django

asp.net-mvc - Google 日历在 ASP .net 中添加事件 : Auth fail

google-api - 在谷歌日历 API v3 中插入​​新的 calendarEntry 返回 404