我正在创建一个从谷歌日历中提取事件的在线议程,它目前正在提取重复事件的第一个实例的开始日期。我可以用 api 和 javascript 做些什么来显示每个事件的实际日期,而不仅仅是第一个实例?
我的 HTML:
<div ng-controller="calCtrl">
<div ng-repeat="event in events">
<div class="event-row">
<span id="eventTitle">{{ event.summary }}</span>
<span id="eventDate">{{ event.start.date | date:'EEE M/d/yyyy' }}{{ event.start.dateTime | date:'EEE M/d/yyyy' }}</span> //
<span id="eventTime">{{event.start.dateTime | date:'H:mm' }}</span>
<span id="eventLocation">{{event.location}}</span>
</div>
</div>
到目前为止,我的 JS:
var app = angular.module('eventApp', []);
app.factory('calendarServ', ['$http', function($http) {
var today = (new Date()).toISOString();
var APIKey = "___________";
var url = "https://www.googleapis.com/calendar/v3/calendars/–––––––/events?maxResults=30&&timeMin=" + today + "&key=" + APIKey;
return $http.get(url)
.success(function(data) {
return data;
})
.error(function(err) {
return err;
});
}]);
app.controller('calCtrl', ["$scope", "$http", "calendarServ", function($scope, $http, calendarServ) {
$scope.events;
calendarServ.success(function(data) {
$scope.events = data.items;
});
}]);