1
+ <!doctype html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < title > AngularJS Clndr Directive</ title >
6
+ < link href ="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css " rel ="stylesheet ">
7
+ < link href ="angular-clndr.css " rel ="stylesheet ">
8
+ < style >
9
+ body {
10
+ margin-top : 1em ;
11
+ }
12
+ p {
13
+ line-height : 24px ;
14
+ }
15
+ </ style >
16
+ </ head >
17
+ < body class ="container ">
18
+ < div class ="row ">
19
+ < div class ="col-lg-10 col-lg-offset-1 col-md-12 ">
20
+ < div class ="jumbotron ">
21
+ < h1 > angular-clndr</ h1 >
22
+
23
+ < p > Angular directive for CLNDR.js</ p >
24
+ </ div >
25
+ < div class ="row ">
26
+ < div class ="col-md-12 ">
27
+ < h2 > Getting Started</ h2 >
28
+ < ol >
29
+ < li > Install with bower: < code > bower install --save angular-clndr</ code > </ li >
30
+ < li > Include < code > angular-clndr.js</ code > .</ li >
31
+ < li > Make sure to include all CLNDR.js dependencies.</ li >
32
+ < li > Add < code > tien.clndr</ code > to you app modules.</ li >
33
+ < li > Use the < code > tien-clndr</ code > directive.</ li >
34
+ </ ol >
35
+
36
+ If you don't like package managers, you can also directly download
37
+ < a href ="./angular-clndr.js "> angular-clndr.js</ a > or
38
+ < a href ="./angular-clndr.min.js "> angular-clndr.min.js</ a > .
39
+ </ div >
40
+ </ div >
41
+ < hr >
42
+ < div class ="row " ng-app ="clndrApp ">
43
+ < div class ="col-md-12 " ng-controller ="DemoCtrl ">
44
+ < h2 > Demo</ h2 >
45
+
46
+ < tien-clndr class ="clndr " tien-clndr-object ="clndr " tien-clndr-events ="events ">
47
+ < div class ="clndr-controls ">
48
+ < div class ="clndr-previous-button " ng-click ="clndr.back() ">
49
+ ‹
50
+ </ div >
51
+ < div class ="month ">
52
+ {{month}}
53
+ </ div >
54
+ < div class ="clndr-next-button " ng-click ="clndr.forward() ">
55
+ ›
56
+ </ div >
57
+ </ div >
58
+ < div class ="clndr-grid ">
59
+ < div class ="days-of-the-week ">
60
+ < div class ="header-day " ng-repeat ="day in daysOfTheWeek track by $index ">
61
+ {{day}}
62
+ </ div >
63
+ </ div >
64
+ < div class ="days ">
65
+ < div class ="{{day.classes}} " ng-repeat ="day in days ">
66
+ < div class ="event-indicator " ng-show ="day.events " ng-click ="showEvents(day.events) "> {{day.events.length}}</ div >
67
+ {{day.day}}
68
+ </ div >
69
+ </ div >
70
+ </ div >
71
+ </ tien-clndr >
72
+ </ div >
73
+ </ div >
74
+
75
+ < script src ="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js "> </ script >
76
+ < script src ="//ajax.googleapis.com/ajax/libs/angularjs/1.2.22/angular.min.js "> </ script >
77
+ < script src ="//kylestetz.github.io/CLNDR/js/moment.js "> </ script >
78
+ < script src ="//kylestetz.github.io/CLNDR/js/clndr.js "> </ script >
79
+ < script src ="angular-clndr.js "> </ script >
80
+ < script >
81
+ app = angular . module ( 'clndrApp' , [ 'tien.clndr' ] ) ;
82
+ app . controller ( 'DemoCtrl' , function ( $scope ) {
83
+ $scope . events = [
84
+ { date : moment ( ) . add ( 3 , 'days' ) . format ( ) , title : "Happy days" } ,
85
+ { date : moment ( ) . subtract ( 5 , 'days' ) . format ( ) , title : "Good old days" } ,
86
+ { date : moment ( ) . subtract ( 5 , 'days' ) . format ( ) , title : "And some more" }
87
+ ] ;
88
+ $scope . showEvents = function ( events ) {
89
+ alert ( events . map ( function ( e ) { return e . title } ) . join ( "\n" ) ) ;
90
+ } ;
91
+ } ) ;
92
+ </ script >
93
+
94
+ < hr >
95
+ < div class ="row ">
96
+ < div class ="col-md-12 ">
97
+ < h2 > Usage</ h2 >
98
+ < p >
99
+ Use the < code > tien-clndr</ code > directive as element, all childs of this element have
100
+ CLNDR.js data available on the object provided with the < code > tien-clndr-object</ code >
101
+ attributes. With this object on the child's scope, you can for example ng-repeat over the
102
+ days and render the template Angular-style.
103
+ </ p >
104
+ < p >
105
+ Optionally pass an < a href ="https://github.com/kylestetz/CLNDR#pass-in-your-events "> array of events</ a >
106
+ to the directive with the < code > tien-clndr-events</ code > attribute. Events are available
107
+ on the scope at < code > day.events</ code > , as shown in the example below:
108
+ </ p >
109
+ < pre > < code > <tien-clndr class="clndr" tien-clndr-object="clndr" tien-clndr-events="events">
110
+ <div class="clndr-controls">
111
+ <div class="clndr-previous-button" ng-click="clndr.back()">
112
+ &lsaquo;
113
+ </div>
114
+ <div class="month">
115
+ {{month}}
116
+ </div>
117
+ <div class="clndr-next-button" ng-click="clndr.forward()">
118
+ &rsaquo;
119
+ </div>
120
+ </div>
121
+ <div class="clndr-grid">
122
+ <div class="days-of-the-week">
123
+ <div class="header-day" ng-repeat="day in daysOfTheWeek track by $index">
124
+ {{day}}
125
+ </div>
126
+ </div>
127
+ <div class="days">
128
+ <div class="{{day.classes}}" ng-repeat="day in days">
129
+ <div class="event-indicator" ng-show="day.events" ng-click="showEvents(day.events)">{{day.events.length}}</div>
130
+ {{day.day}}
131
+ </div>
132
+ </div>
133
+ </div>
134
+ </tien-clndr></ code > </ pre >
135
+ </ div >
136
+ </ div >
137
+ < hr >
138
+ < div class ="row ">
139
+ < div class ="col-md-12 ">
140
+ < p class ="text-center ">
141
+ angular-clndr 0.1.0 · Created by < a href ="http://10kb.nl/ "> 10KB</ a > < br >
142
+ Based on < a href ="http://kylestetz.github.io/CLNDR/ "> CLNDR.js</ a > .
143
+ </ p >
144
+ < p class ="text-center ">
145
+ < a href ="https://github.com/10KB/angular-clndr "> GitHub Project</ a >
146
+ </ p >
147
+ </ div >
148
+ </ div >
149
+ </ div >
150
+ </ div >
151
+ </ body >
152
+ </ html >
0 commit comments