如何使用 angular 读取 public google 日历中的事件
how to read events in public google calendar using angular
我有一个嵌入我网站的 google 日历,但我希望能够从日历中提取事件详细信息(日期、时间、事件描述、地址)并使用 angular 这样我就可以重新格式化它并在我的页面上显示它。
我不需要与它交互(意味着更新、删除、编辑任何东西),只需从中提取事件。
Angular API(或其他调用)是否可行?
是的,这是可能的,因为 Google 提供 Google 日历 APIs
首先,您必须使用此 link 为您的日历打开 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以获得更多示例和更完整的解释
我有一个嵌入我网站的 google 日历,但我希望能够从日历中提取事件详细信息(日期、时间、事件描述、地址)并使用 angular 这样我就可以重新格式化它并在我的页面上显示它。
我不需要与它交互(意味着更新、删除、编辑任何东西),只需从中提取事件。
Angular API(或其他调用)是否可行?
是的,这是可能的,因为 Google 提供 Google 日历 APIs
首先,您必须使用此 link 为您的日历打开 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以获得更多示例和更完整的解释