I would like to create a mini-calendar that is placed on the side my page. The user can switch the months by placing the left/right key. To initialize the mini calendar, I need to give it current day
, month
, year
. The mini-calendar need to run through three for
loops:
loop 1: preceding month
loop 2: current month
loop 3: next month
This is to fill the day of the week that are visible from previous and next month. I also want to shade the current day
grey and draw a block around the selected day
.
So all of this currently works for me with Laravel and the template blade. My controller passes the day
, month
, year
, and inside the template view, I run the three loops and create what I need.
Question 1: Currently, I need to do some logic within my template view (that is to determine how many days in the previous month, and how many days in the next month, and if this day is current/selected day. Is this bad? Should I move everything into the controller, and then pass extra parameters (daysInPreviousMonth
and daysInNextMonth
) instead to the view?
Question 2: How do I go about having AngularJS use the same template when the user changes the month? I want to be able to use the same set of template code if possible.