Android Ionic Angularjs ui日历基于月份获取事件
嗨,我是angularjs新手,我尝试使用angularjs版本的jquery完整日历。我的问题是,我能够获取加载的所有事件。是否可以基于月份获取单击下一个或上一个的事件以获取该特定月份的事件 用于在加载时获取事件的代码Android Ionic Angularjs ui日历基于月份获取事件,android,angularjs,fullcalendar,ionic,Android,Angularjs,Fullcalendar,Ionic,嗨,我是angularjs新手,我尝试使用angularjs版本的jquery完整日历。我的问题是,我能够获取加载的所有事件。是否可以基于月份获取单击下一个或上一个的事件以获取该特定月份的事件 用于在加载时获取事件的代码 var calCurrentDate = $filter('date')(new Date(), 'yyyy-MM-dd'); $scope.init = function() { console.log('this is the new calCurrentD
var calCurrentDate = $filter('date')(new Date(), 'yyyy-MM-dd');
$scope.init = function() {
console.log('this is the new calCurrentDate'+calCurrentDate);
$ionicLoading.show({template: '<i class="icon ion-loading-c"></i>'});
var req = {
method: 'GET',
url: link+'meal/calendar?api_token='+$localStorage.accessToken+'&start_date='+calCurrentDate+'&id=',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}
console.log(req);
$http(req).success(function(data) {
$scope.schedule = data.dayplan;
for(i in $scope.schedule) {
$scope.events.push({
id: $scope.schedule[i].id,
title: '.',
start: $scope.schedule[i].day,
color: $scope.schedule[i].color_code
});
}
$ionicLoading.hide();
}).error(function(data) {
console.log(data.message);
$ionicLoading.hide();
});
};
而且也像这样试过
$scope.renderView = function(view){
var date = new Date(view.calendar.getDate());
$scope.arrowDate = $filter('date')(date, 'yyyy-MM-dd');
if($scope.arrowDate != calCurrentDate){
$ionicLoading.show({template: '<i class="icon ion-loading-c"></i>'});
var req = {
method: 'GET',
url: link+'meal/calendar?api_token='+$localStorage.accessToken+'&start_date='+$scope.arrowDate+'&id=',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}
console.log($scope.arrowDate);
$http(req).success(function(data) {
$scope.schedule = data.dayplan;
for(i in $scope.schedule) {
$scope.events.push({
id: $scope.schedule[i].id,
title: '.',
start: $scope.schedule[i].day,
color: $scope.schedule[i].color_code
});
}
$ionicLoading.hide();
}).error(function(data) {
console.log(data.message);
$ionicLoading.hide();
});
}
};
问题是它会获取数据,但会返回到当月
如果当前月份是2月,如果单击“下一步”,我可以获取3月的数据,但它会返回到2月,而不是停留在3月,任何帮助都将不胜感激。提前感谢。回答的问题是$scope.event.push这里我是如何解决的
if($scope.arrowDate != calCurrentDate){
$ionicLoading.show({template: '<i class="icon ion-loading-c"></i>'});
var req = {
method: 'GET',
url: link+'meal/calendar?api_token='+$localStorage.accessToken+'&start_date='+$scope.arrowDate+'&id=',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}
$http(req).success(function(data) {
console.log(data.message);
$scope.schedule = data.dayplan;
var tmpEvent = [];
for(i in $scope.schedule) {
tmpEvent.push({
id: $scope.schedule[i].id,
title: '.',
start: $scope.schedule[i].day,
color: $scope.schedule[i].color_code
});
}
uiCalendarConfig.calendars.myCalendar.fullCalendar('removeEvents');
uiCalendarConfig.calendars.myCalendar.fullCalendar( 'addEventSource', tmpEvent);
$scope.fetchMeal($scope.arrowDate);
$ionicLoading.hide();
}).error(function(data) {
console.log(data.message);
$ionicLoading.hide();
});
}
if($scope.arrowDate != calCurrentDate){
$ionicLoading.show({template: '<i class="icon ion-loading-c"></i>'});
var req = {
method: 'GET',
url: link+'meal/calendar?api_token='+$localStorage.accessToken+'&start_date='+$scope.arrowDate+'&id=',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}
$http(req).success(function(data) {
console.log(data.message);
$scope.schedule = data.dayplan;
var tmpEvent = [];
for(i in $scope.schedule) {
tmpEvent.push({
id: $scope.schedule[i].id,
title: '.',
start: $scope.schedule[i].day,
color: $scope.schedule[i].color_code
});
}
uiCalendarConfig.calendars.myCalendar.fullCalendar('removeEvents');
uiCalendarConfig.calendars.myCalendar.fullCalendar( 'addEventSource', tmpEvent);
$scope.fetchMeal($scope.arrowDate);
$ionicLoading.hide();
}).error(function(data) {
console.log(data.message);
$ionicLoading.hide();
});
}