Sunil Garg Sunil Garg - 5 months ago 60
AngularJS Question

how to bind click on year/Month/Week/Day in angular bootstrap calendar (mwl.calendar)

I am using angular-bootstrap calendar. Here is the link

I want to bind click on Year/Month/Day/Week button. I have read all the documentation but didn't get any clue even I tried to edit internal files but not able to do so.
enter image description here


A little late, but if you want to modify the calendar-view based on the button being clicked - this is what you need to do: Define your buttons and specify the click-event (I called it switchView) like this:

    <button type="submit" class="btn btn-primary" ng-click="switchView('day')">Day View </button>
    <button type="submit" class="btn btn-primary" ng-click="switchView('week')">Week View</button>
    <button type="submit" class="btn btn-primary" ng-click="switchView('month')">Month View</button>
    <button type="submit" class="btn btn-primary" ng-click="switchView('year')">Year View</button>

Then in your controller, you switch the view like this:

$scope.switchView = function (viewType){
  console.log('switchView:: viewType', viewType);
  //here I switch the calendar-view
  $scope.calendarView = viewType;

I hope this helps you and others. I used this technique in my application.