Open anujshsdei opened 7 years ago
Hello,
I am trying to implement the businessHours to calendar. If I provide the static values it works perfectly but If I tried to provide dynamic values it shows events twice on a date.
Below is my code -
$scope.times = []; $scope.sampleFunc = function() { Appointment.getUser() .then(function(response) { $scope.user = response.data.user;
$scope.uiConfig.calendar.businessHours = { dow:$scope.user.business_day, start:$scope.user.business_start, end:$scope.user.business_end } }) .catch(function(response) { toastr.error(response.data.msg,'Error'); });
};
// Calendar var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear();
/* event source that calls a function on every view switch */ $scope.eventsF = function (start, end, timezone, callback) { var s = new Date(start).getTime() / 1000; var e = new Date(end).getTime() / 1000; var m = new Date(start).getMonth(); var events = $scope.events; callback(events); }; /* Open edit appointment moahl on event click */ $scope.alertOnEventClick = function( date, jsEvent, view){ $scope.edit(date.id); }; /* Tooltip */ $scope.eventRender = function( event, element, view ) { element.attr({'uib-tooltip': event.title,'tooltip-append-to-body': true}); $compile(element)($scope); }; $scope.uiConfig = { calendar:{ height: 700, editable: false, disabled: true, header:{ left: 'title', center: '', right: 'today prev,next' }, eventClick: $scope.alertOnEventClick, eventRender: $scope.eventRender } }; $scope.eventSources = [$scope.events, $scope.eventsF];
I am getting $scope.events from another function of the same controller. All the above code written in same controller.
Hello,
I am trying to implement the businessHours to calendar. If I provide the static values it works perfectly but If I tried to provide dynamic values it shows events twice on a date.
Below is my code -
$scope.times = []; $scope.sampleFunc = function() { Appointment.getUser() .then(function(response) { $scope.user = response.data.user;
};
// Calendar var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear();
I am getting $scope.events from another function of the same controller. All the above code written in same controller.