mattlewis92 / angular-bootstrap-calendar

A port of the bootstrap calendar widget to AngularJS (no jQuery required!)
https://mattlewis92.github.io/angular-bootstrap-calendar/
MIT License
798 stars 369 forks source link

feature request: day-view-start/end changeable per binding #627

Closed spotlight2001 closed 7 years ago

spotlight2001 commented 7 years ago

Feature request:

i think it would be a good feature to be able to change between 24h/view and work hours.

like so: calendarConfig.showTimesOnWeekView = true; day-view-start="{{vm.dayViewStart}}"

but if i use this to swap alter the day-view-start the events are at the incorrect position regarding the times for the week view.

Link to minimally-working plunker that reproduces the issue

http://plnkr.co/edit/KvCr3CIPIfNlehfXITDl?p=preview

Versions

angular-bootstrap-calendar 0.29.2

Angular: 1.5.11

Calendar library: ?

Browser name and version: chrome - Version 59.0.3071.115 (Official Build) (64-bit) same on firefox

burtek commented 7 years ago

Thank you for providing plunker with example.

You can manually request the view to refresh:

vm.show24Hours = function() {
  vm.dayViewStart = '00:00';
  vm.dayViewEnd = '23:00';

  $timeout(rv);
};

vm.showOnlyWorkHours = function() {
  vm.dayViewStart = '08:00';
  vm.dayViewEnd = '20:00';

  $timeout(rv);
};

function rv() {
  $scope.$broadcast('calendar.refreshView');
}

Of course you will need to inject $timeout and $scope into your controller.

Plunker: http://plnkr.co/edit/brlQZ0HfXVendG5nr7OA?p=preview