Calendar in pure angularJS -



Calendar in pure angularJS -

i don't want utilize ui-calendar/full calendar in project, want create calendar in pure angularjs. trying this, got confused in between. i'm pasting code have done. please tell me how right it.

js is:

app.controller('calendarctrl', function ($scope) { $scope.weekday = [ 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday' ]; $scope.montha = [ 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december' ]; $scope.mdays = [ 31,28,31,30,31,30,31,31,30,31,30,31 ]; var today = new date(); $scope.date = today.getdate(); $scope.month = today.getmonth(); $scope.dow = today.getday(); var year = today.getyear(); $scope.year = year; $scope.day = 1; var i, j; if (year < 2000) { year += 1900; } $scope.year = year; if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 !=0))) mdays[1] = 29; var mfirst = today; mfirst.setdate(1); var dow1 = mfirst.getday(); console.log($scope.weekday[dow1]); });

and view is:

<div class="row"> <div class="col-md-1">sun</div> <div class="col-md-1">mon</div> <div class="col-md-1">tue</div> <div class="col-md-1">wed</div> <div class="col-md-1">thu</div> <div class="col-md-1">fri</div> <div class="col-md-1">sat</div> </div> <div class="row" ng-repeat="i in [] | range:6"> <div class="col-md-1" ng-repeat="j in [] | range:7"> <div ng-if="(i == 0 && j < dow1) || (day > mdays[month])"> &nbsp; </div> <div ng-if="!((i == 0 && j < dow1) || (day > mdays[month]))"> {{day}} </div> </div>

i know above code creating div within div, not right way. how do it? please help!

we came across , integrating now. https://github.com/twinssbc/angularjs-responsivecalendar

this looks promising wants pure angularjs

angularjs calendar

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -