We are developing an application to schedule medical appointments using full calendar and angularjs
We generate a code (render) to show us in the form of events the appointments that were saved, but when browsing the calendar, either in the Month, Week or Day views, I duplicate these events.
function eventScroll(){
vm.eventSourcees = [];
var datosCalendario;
if (vm.fechaInicio !== null && vm.fechaFin !== null){
Horarios.queryByFechas({
fechaInicio: $filter('date')(vm.startDate, 'yyyy-MM-dd', '-0500'),
fechaFin: $filter('date')(vm.endDate, 'yyyy-MM-dd', '-0500')
}).promise.then(function(data){
for(var i = 0; i < data.length; i++){
vm.eventSource.push({
id: data[i].idHorario,
title: data[i].descCita,
start: new DAte(data[i].fechaHorario),
allDay: false
});
}).catch(function (error){
console.log(error);
});
}
}
function renderView(view){
vm.startDate = new DAte(view.start);
vm.endDate = new DAte(view.end);
console.log('render');
eventScroll();
}