-
Notifications
You must be signed in to change notification settings - Fork 129
/
index.html
946 lines (888 loc) · 52.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0">
<title>Angularjs directives for Materialize CSS Framework</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/css/materialize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/0.0.1/prism.min.css">
<link rel="stylesheet" href="css/style.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!-- TODO: Waiting for https://github.com/Dogfalo/materialize/pull/3570 to become part of Materialize, before we can upgrade to jQuery 3 -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/prism/0.0.1/prism.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/js/materialize.min.js"></script>
<script type="text/javascript" src="src/angular-materialize.js"></script>
<!-- Only for the clockpicker -->
<script type="text/javascript" src="js/materialize.clockpicker.js"></script>
<link rel="stylesheet" href="css/materialize.clockpicker.css">
<!-- App -->
<script type="text/javascript" src="js/app.js"></script>
</head>
<body ng-app="materializeApp" ng-controller="BodyController">
<header>
<div class="container"><a href="#" data-activates="nav-mobile" class="button-collapse top-nav" data-sidenav="left" data-closeonclick="false"><i
class="mdi-navigation-menu"></i></a></div>
<ul id="nav-mobile" class="side-nav fixed">
<!--Maybe a logo?-->
<!--<li class="logo" style="margin-left: -15px;"><a id="logo-container" href="http://materializecss.com/"class="brand-logo"><h3></h3></a></li>-->
<li class="bold"><a href="#about" class="waves-effect waves-teal">About angular-materialize</a></li>
<li class="bold"><a href="#getting-started" class="waves-effect waves-teal">Getting started</a></li>
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold"><a class="collapsible-header waves-effect waves-teal active">Forms</a>
<div class="collapsible-body">
<ul>
<li><a href="#input-field">Input-field</a></li>
<li><a href="#input-date">Input-date</a></li>
<li><a href="#input-clock">Input-clock</a></li>
<li><a href="#select">Material select</a></li>
<li><a href="#range">Range select</a></li>
</ul>
</div>
</li>
</ul>
</li>
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold"><a class="collapsible-header waves-effect waves-teal active">JavaScript</a>
<div class="collapsible-body">
<ul>
<li><a href="#carousel">Carousel</a></li>
<li><a href="#collapsible">Collapsible</a></li>
<li><a href="#chips">Chips</a></li>
<li><a href="#toast">Dialogs - Toast</a></li>
<li><a href="#tooltip">Tooltip</a></li>
<li><a href="#pushpin">Pushpin</a></li>
<li><a href="#dropdown">Dropdown</a></li>
<li><a href="#modals">Modals</a></li>
<li><a href="#parallax">Parallax</a></li>
<li><a href="#scrollfire">ScrollFire</a></li>
<li><a href="#sidenav">SideNav</a></li>
<li><a href="#slider">Slider</a></li>
<li><a href="#media">Media</a></li>
<li><a href="#tabs">Tabs</a></li>
</ul>
</div>
</li>
</ul>
</li>
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold"><a class="collapsible-header waves-effect waves-teal active">Components</a>
<div class="collapsible-body">
<ul>
<li><a href="#pagination">Pagination</a></li>
</ul>
</div>
</li>
</ul>
</li>
</ul>
</header>
<main>
<div class="section" id="index-banner">
<div class="container">
<div class="row">
<div class="col s12">
<h1 class="header center-on-small-only"><a href="https://github.com/kresCruz/angular-materialize" style="color:white;">Angular-materialize</a></h1>
<p style="color: white;" class="center-on-small-only">This is a collection of simple angular directives for using the features in <a href="http://materializecss.com">materializecss</a>. </p>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row" id="about">
<h2 class="header">About angular-materialize</h2>
<p>This plugin is useful for you if you want to use the <a href="http://materializecss.com/">Materialize UI framework</a> with angular. </p>
<p>It includes a number of directives, which makes sure that the components in materialize.js, which are mainly initialized on document ready, are handled by Angular in the right way.<p>
<p>So it is not a complete rewrite of Materialize. And it therefore depends on jQuery, because Materialize depends on jQuery.</p>
<p>Below is a small example to get you started, and below that documentation for the directives which are included in this plugin. <br />
Some parts of materialize, like the CSS framework, doesn't require anything extra to work in an Angular context, and they are therefore not covered here. <br />
A list of the features in Materialize which does not yet work with angular-materialize can be found in <a href="https://github.com/krescruz/angular-materialize/blob/master/README.md#missing-features">the readme on Github</a>.
</p>
</div>
<div class="row" id="getting-started">
<h2 class="header">Getting started</h2>
<p>This plugin and all of its dependencies are hosted on CDNs, which makes setup easy. <br />
To get a minimal example up and running, copy the below into index.html and app.js: </p>
<pre><code class="language-markup" ng-non-bindable><html>
<head>
<title>Minimal example</title>
<!-- Materialize CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/css/materialize.min.css">
<!-- JavaScript for: jQuery, angular, materialize, and angular-materialize. All of which are needed. -->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/js/materialize.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular-materialize/0.2.2/angular-materialize.min.js"></script>
<!-- Your app -->
<script type="text/javascript" src="app.js"></script>
</head>
<body ng-app="materializeApp" ng-controller="BodyController">
<main>
<div class="container">
<div class="row">
<div class="section col s4">
<div input-field>
<select ng-model="select.value" material-select>
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
</div>
</div>
<div class="section col s8">
<h5>You selected: <b>{{select.value}}</b></h5>
</div>
</div>
</div>
</main>
</body>
</html></code></pre>
<pre><code class="language-javascript" ng-non-bindable>var app = angular.module('materializeApp', ['ui.materialize'])
.controller('BodyController', ["$scope", function ($scope) {
$scope.select = {
value: "Option1",
choices: ["Option1", "I'm an option", "This is materialize", "No, this is Patrick."]
};
}]);</code></pre>
</div>
<div class="row" id="input-field">
<h2 class="header">Input-field</h2>
<p>Materialize uses the class .input-field to manage animating labels and input-fields. But that doesn't work properly when angular dynamically creates element</p>
<p>Instead of adding the class input-field, use the input-field directive. This way it still works when angular dynamically creates it.</p>
<p>Just in Materialize, if you add the length attribute, a character-counter will appear (in the below length is set to 150). </p>
<p>The <code class="language-markup" data-language="markup">input</code> or <code class="language-markup" data-language="markup">textarea</code> tags has to be direct children of the element with the input-field tag. </p>
</div>
<div class="row" ng-init="showInputLabel = true;dummyInputs.inputFieldInput = 'This is input'; dummyInputs.textAreaInput = 'Textareas \ncan\ncontain\nmultiple\nlines';">
<div class="col s2">
<a class="btn waves-effect waves-light" ng-click="showInputLabel = !showInputLabel">Toggle input</a>
</div>
<div class="col s4" ng-if="showInputLabel">
<div input-field>
<input type="text" ng-model="dummyInputs.inputFieldInput" length="150">
<label>Input label</label>
</div>
</div>
<div class="col s3" ng-if="showInputLabel">
<div input-field>
<textarea ng-model="dummyInputs.textAreaInput" class="materialize-textarea"></textarea>
<label>Textarea</label>
</div>
</div>
<div class="col s3" ng-if="showInputLabel">
<div input-field>
<textarea ng-model="dummyInputs.textAreaInput" class="materialize-textarea"></textarea>
<label>Synchronized textarea</label>
</div>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<div input-field>
<input type="text" ng-model="dummyInputs.inputFieldInput" length="150">
<label>Input label</label>
</div>
<div input-field>
<textarea ng-model="dummyInputs.textAreaInput" class="materialize-textarea"></textarea>
<label>Textarea</label>
</div></code></pre>
</div>
<div class="row">
<p>You can also use it as an element instead of an attribute.</p>
<pre><code class="language-markup" ng-non-bindable>
<input-field>
<input type="text" ng-model="dummyInputs.inputFieldInput">
<label>Input label</label>
</input-field>
<input-field>
<textarea ng-model="dummyInputs.textAreaInput" class="materialize-textarea"></textarea>
<label>Textarea</label>
</input-field></code></pre>
</div>
<div class="row" id="input-date">
<h2 class="header">Input-date</h2>
<p>The below example is where there are values in all the options, but all the options are optional. </p>
<p>The attributes <code class="language-markup" data-language="markup">min</code> and <code class="language-markup" data-language="markup">max</code> can be any value representing a date. It should be in a format recognised by <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date" target="_blank" title="Date - JavaScript | MDN">Date Constructor</a>.</p>
</div>
<div class="row" ng-controller="DateController">
<label for="inputCreated">Input date</label>
<input input-date
type="text"
name="created"
id="inputCreated"
ng-model="currentTime"
container=""
format="dd/mm/yyyy"
months-full="{{ month }}"
months-short="{{ monthShort }}"
weekdays-full="{{ weekdaysFull }}"
weekdays-short="{{ weekdaysShort }}"
weekdays-letter="{{ weekdaysLetter }}"
disable="disable"
min="{{ minDate }}"
max="{{ maxDate }}"
today="today"
first-day="1"
clear="clear"
close="close"
select-years="15"
on-start="onStart()"
on-render="onRender()"
on-open="onOpen()"
on-close="onClose()"
on-set="onSet()"
on-stop="onStop()" />
</div>
<div class="row">
<p>The code in the HTML</p>
<pre><code class="language-markup" ng-non-bindable><label for="inputCreated">Input date</label>
<input input-date
type="text"
name="created"
id="inputCreated"
ng-model="currentTime"
container=""
format="dd/mm/yyyy"
months-full="{{ month }}"
months-short="{{ monthShort }}"
weekdays-full="{{ weekdaysFull }}"
weekdays-short="{{ weekdaysShort }}"
weekdays-letter="{{ weekdaysLetter }}"
disable="disable"
min="{{ minDate }}"
max="{{ maxDate }}"
today="today"
first-day="1"
clear="clear"
close="close"
select-years="15"
on-start="onStart()"
on-render="onRender()"
on-open="onOpen()"
on-close="onClose()"
on-set="onSet()"
on-stop="onStop()" /></code></pre>
<p>And the JavaScript in the controller</p>
<pre><code class="language-javascript">var currentTime = new Date();
$scope.currentTime = currentTime;
$scope.month = ['Januar', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
$scope.monthShort = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
$scope.weekdaysFull = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
$scope.weekdaysLetter = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
$scope.disable = [false, 1, 7];
$scope.today = 'Today';
$scope.clear = 'Clear';
$scope.close = 'Close';
var days = 15;
$scope.minDate = (new Date($scope.currentTime.getTime() - ( 1000 * 60 * 60 *24 * days ))).toISOString();
$scope.maxDate = (new Date($scope.currentTime.getTime() + ( 1000 * 60 * 60 *24 * days ))).toISOString();
$scope.onStart = function () {
console.log('onStart');
};
$scope.onRender = function () {
console.log('onRender');
};
$scope.onOpen = function () {
console.log('onOpen');
};
$scope.onClose = function () {
console.log('onClose');
};
$scope.onSet = function () {
console.log('onSet');
};
$scope.onStop = function () {
console.log('onStop');
};</code></pre>
</div>
<div class="row" id="input-clock">
<h2 class="header">Input-clock</h2>
<p>This is a wrapper made around the <a href="https://github.com/chingyawhao/materialize-clockpicker">materialize-clockpicker made by chingyawhao</a></p>
<p>The bundled JavaScript only includes the wrapper JavaScript, and for this to work you need to include the JavaScript and CSS from <a href="https://github.com/chingyawhao/materialize-clockpicker">materialize-clockpicker</a></p>
<p>The options for this wrapper are the same as the options for the original materialize-clockpicker. </p>
<p>Below is a small example, where the option <code class=" language-markup" data-language="markup">twelvehour</code> has been set to false. </p>
</div>
<div class="row">
<label for="input_starttime">Time</label>
<input id="input_starttime" input-clock data-twelvehour="false" type="text">
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<label for="input_starttime">Time</label>
<input id="input_starttime" input-clock data-twelvehour="false" type="text"></code></pre>
</div>
<div class="row" id="select">
<h2 class="header">Material select</h2>
<p>Add the material-select as an attribute to the select where you want material-select.</p>
<p>Not needed if you add the class browser-default.</p>
<p>It doesn't support changing content within the select, add the class browser-default if you want that.</p>
<p>If you add the attribute <code class=" language-markup" data-language="markup">watch</code>, then the material-select will re-initialize whenever something changes in the content within the select. <br />
That includes if the number of list elements change. <br />
But beware, while the implementation works, it is very heavy in computation, so tread lightly. </p>
</div>
<div class="row">
<div class="section col s4">
<div input-field>
<select class="" ng-model="select.value1" material-select watch>
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
</div>
</div>
<div class="section col s8">
<h5>You selected: <b>{{select.value1}}</b></h5>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<div input-field>
<select class="" ng-model="select.value1" material-select watch>
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
</div></code></pre>
</div>
<div class="row">
<h5>Multiple select</h5>
<div class="section col s4">
<div input-field>
<select class="" ng-model="select.value3" material-select multiple watch>
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
</div>
</div>
<div class="section col s8">
<h5>You selected: <b>{{select.value3}}</b></h5>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<div input-field>
<select class="" ng-model="select.value3" material-select multiple watch>
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
</div></code></pre>
</div>
<div class="row">
<h5>Using class browser-default</h5>
<div class="section col s4">
<div input-field>
<select class="browser-default" ng-model="select.value2">
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
</div>
</div>
<div class="section col s8">
<h5>You selected: <b>{{select.value2}}</b></h5>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<div input-field>
<select class="browser-default" ng-model="select.value2">
<option ng-repeat="value in select.choices">{{value}}</option>
</select>
</div></code></pre>
</div>
<div class="row" id="range">
<h2 class="header">Range - noUiSlider</h2>
<p>You can use the HTML5 range element without needing to use a directive or extra JavaScript.
If you want to use the noUiSlider jQuery plugin that ships with materializecss,
you'll need to include <a href="https://cdnjs.com/libraries/noUiSlider">noUiSlider's JS and CSS file</a> and use the <code class="language-markup" data-language="markup">nouislider</code> directive. <br />
<pre><code class="language-markup" ng-non-bindable>
<div nouislider ng-model="value" min="5" max="300"></div>
</code></pre>
<p>
See <a href="http://refreshless.com/nouislider/slider-options/">noUiSlider's docs</a> for how to use it. Supported config options are: ngModel (required), min, max, step, connect, and tooltips.
</p>
</div>
<div class="row" id="carousel">
<h2 class="header">Carousel</h2>
<p>A simple directive, that enables the carousel. Just add the attribute <code class=" language-markup" data-language="markup">carousel</code>, and the carousel will be initialized. </p>
<p>You can optionally set one of more of the attributes
<code class=" language-markup" data-language="markup">duration</code>,
<code class=" language-markup" data-language="markup">dist</code>,
<code class=" language-markup" data-language="markup">shift</code>,
<code class=" language-markup" data-language="markup">padding</code>,
<code class=" language-markup" data-language="markup">full-width</code>,
<code class=" language-markup" data-language="markup">height</code>,
<code class=" language-markup" data-language="markup">indicators</code> or
<code class=" language-markup" data-language="markup">no-wrap</code>, and the option will be passed to the slider. <br />
Like so: <code class=" language-markup" data-language="markup"><div carousel duration='500' no-wrap='true'></div></code>
<br/>
The options correspond to the options in the <a href="http://materializecss.com/carousel.html">Materialize documentation</a>
</p>
</div>
<div class="row">
<div carousel>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature1.jpg"></a>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature2.jpg"></a>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature3.jpg"></a>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature4.jpg"></a>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature5.jpg"></a>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable><div carousel>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature1.jpg"></a>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature2.jpg"></a>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature3.jpg"></a>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature4.jpg"></a>
<a class="carousel-item" href="javascript:void(0);"><img src="images/nature5.jpg"></a>
</div></code></pre>
</div>
<div class="row" id="collapsible">
<h2 class="header">Collapsible</h2>
<p>The collapsible below is populated using ng-repeat, just to show that it is possible. You can also just manually put in the content. </p>
<p>In the below, the popout class is added, which makes a "Google inbox" effect. Just remove the popout class to get a normal accordion. </p>
<p>Since this is just a wrapper for materializes collapsible, <a href="http://materializecss.com/collapsible.html">all their customization</a> can be used. </p>
<p>If you add the attribute <code class=" language-markup" data-language="markup">watch</code>, then the collapsible will re-initialize whenever something changes in the content within the collapsible. <br />
That includes if the number of list elements change. <br />
But beware, while the implementation works, it is very heavy in computation, so tread lightly. </p>
<a class="btn waves-effect waves-light" ng-init="showCollapsible = true" ng-click="showCollapsible = !showCollapsible">Show/hide the below collapsible</a>
</div>
<div class="row" ng-controller="CollapsibleController" ng-if="showCollapsible">
<ul class="collapsible popout" data-collapsible="accordion" watch>
<li ng-repeat="single in collapsibleElements">
<div class="collapsible-header"><i class="{{single.icon}}"></i>{{single.title}}</div>
<div class="collapsible-body"><p>{{single.content}}</p></div>
</li>
</ul>
</div>
<div class="row">
<p>The code in the HTML</p>
<pre><code class="language-markup" ng-non-bindable><ul class="collapsible popout" data-collapsible="accordion" watch>
<li ng-repeat="single in collapsibleElements">
<div class="collapsible-header"><i class="{{single.icon}}"></i>{{single.title}}</div>
<div class="collapsible-body"><p>{{single.content}}</p></div>
</li>
</ul></code></pre>
<p>And the JavaScript in the controller</p>
<pre><code class="language-javascript">$scope.collapsibleElements = [{
icon: 'mdi-image-filter-drama',
title: 'First',
content: 'Lorem ipsum dolor sit amet.'
},{
icon: 'mdi-maps-place',
title: 'Second',
content: 'Lorem ipsum dolor sit amet.'
},{
icon: 'mdi-social-whatshot',
title: 'Third',
content: 'Lorem ipsum dolor sit amet.'
}
];</code></pre>
</div>
<div class="row" id="chips">
<h2 class="header">Chips</h2>
<p>The chips attribute makes sure the jQuery Plugin is run. Use this directive if you want a dynamic chips functionality.</p>
<p>The <code class=" language-markup" data-language="markup">secondary-placeholder</code> is the text you see when there is no item.</p>
<p>And <code class=" language-markup" data-language="markup">placeholder</code> is the text you see when there is more than one item.</p>
</div>
<div class="row" ng-controller="ChipsController">
<div>
<div chips ng-model="chips" secondary-placeholder="Add" placeholder="Add another"></div>
</div>
</div>
<div class="row">
<p>The code in the HTML</p>
<pre><code class="language-markup" ng-non-bindable><div>
<div chips ng-model="chips" secondary-placeholder="secondary placeholder" placeholder="primary placeholder"></div>
</div></code></pre>
<p>And the JavaScript in the controller</p>
<pre><code class="language-javascript">$scope.chips = [{
tag: 'Apple',
}, {
tag: 'Microsoft',
},{
tag: 'Google',
}];</code></pre>
</div>
<div class="row" id="toast">
<h2 class="header">Toasts</h2>
<p>Materializes toast is a global function. Using this directive you can call a toast using a custom event (in the below click), and show a message determined by a variable in the scope. <br />
The message is specified through the message attribute, and the duration is set though the duration attribute (defaults to 3000ms if not set).</p>
</div>
<div class="row" ng-controller="ToastController">
<div class="col s4" input-field>
<input id="message" type="text" ng-model="dummyInputs.message" ng-init="dummyInputs.message = 'I\'m a message'">
<label for="message">Message</label>
</div>
<div class="col s2" input-field>
<input id="toastDuration" type="text" ng-model="dummyInputs.duration" ng-init="dummyInputs.duration = 1000">
<label for="toastDuration">Toast duration</label>
</div>
<div class="input-field col s4">
<a class="waves-effect waves-light btn" message="{{dummyInputs.message}}" duration="{{dummyInputs.duration}}" callback="callback('Your toast was dismissed')" toast='click'>Toast!</a>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable><div class="row">
<div class="col s4" input-field>
<input id="message" type="text" ng-model="dummyInputs.message" ng-init="dummyInputs.message = 'I\'m a message'">
<label for="message">Message</label>
</div>
<div class="col s2" input-field>
<input id="toastDuration" type="text" ng-model="dummyInputs.duration" ng-init="dummyInputs.duration = 1000">
<label for="toastDuration">Toast duration</label>
</div>
<div class="input-field col s4">
<a class="waves-effect waves-light btn" message="{{dummyInputs.message}}" duration="{{dummyInputs.duration}}" toast='click'>Toast!</a>
</div>
</div></code></pre>
</div>
<div class="row" id="tooltip">
<h2 class="header">Tooltip</h2>
<p>The tooltipped attribute in the below makes sure that the jQuery plugin is run.<br />
You can set attributes on the tag, matching the names of the options in the materializeCSS's version.
You can disable tooltip, passing false to tooltipped attribute.
</p>
<div class="col s4" >
<a class="btn waves-effect waves-light" ng-init="showTooltippedButtons = true" ng-click="showTooltippedButtons = !showTooltippedButtons" style="margin-bottom: 10px;">Toggle Buttons</a>
<a class="btn waves-effect waves-light" ng-init="showTooltips = true" ng-click="showTooltips = !showTooltips" style="margin-bottom: 10px;">Toggle Tooltips</a>
</div>
<div class="col s8" ng-if="showTooltippedButtons">
<!-- data-position can be : bottom, top, left, or right -->
<!-- data-delay controls delay before tooltip shows (in milliseconds)-->
<a tooltipped="{{showTooltips}}" class="btn col s4 offset-s4 l2 offset-l1" data-position="bottom" data-delay="50" data-tooltip="I am bottom tooltip"> Bottom</a>
<a tooltipped="{{showTooltips}}" class="btn col s4 offset-s4 l2 offset-l1" data-position="top" data-delay="150" data-tooltip="I am top tooltip"> Top</a>
<a tooltipped="{{showTooltips}}" class="btn col s4 offset-s4 l2 offset-l1" data-position="left" data-delay="250" data-tooltip="I am left tooltip"> Left</a>
<a tooltipped="{{showTooltips}}" class="btn col s4 offset-s4 l2 offset-l1" data-position="right" data-delay="550" data-tooltip="I am right tooltip"> Right</a>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable><div class="col s8" ng-if="showTooltip">
<!-- data-position can be : bottom, top, left, or right -->
<!-- data-delay controls delay before tooltip shows (in milliseconds)-->
<a tooltipped class="btn col s4 offset-s4 l2 offset-l1" data-position="bottom" data-delay="50" data-tooltip="I am tooltip"> Bottom</a>
<a tooltipped class="btn col s4 offset-s4 l2 offset-l1" data-position="top" data-delay="150" data-tooltip="I am tooltip"> Top</a>
<a tooltipped class="btn col s4 offset-s4 l2 offset-l1" data-position="left" data-delay="250" data-tooltip="I am tooltip"> Left</a>
<a tooltipped class="btn col s4 offset-s4 l2 offset-l1" data-position="right" data-delay="550" data-tooltip="I am tooltip"> Right</a>
</div></code></pre>
</div>
<div class="row" id="pushpin">
<h2 class="header">Pushpin</h2>
<p>The <code class=" language-markup" data-language="markup">pushpin</code> attribute allows you to pin a particular element to the top of the page.</p>
<p>You can use the <code class=" language-markup" data-language="markup">pushpin-top</code> attribute to define distance in pixels from the top of the page where the element becomes fixed. The <code class=" language-markup" data-language="markup">pushpin-offset</code> attribute can be used to offset the distance from the top. The <code class=" language-markup" data-language="markup">pushpin-bottom</code> attribute can be used to set the distance in pixels from the top of the page where the elements stops being fixed.</p>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<div class="sidebar" pushpin pushpin-top="0" pushpin-offset="0" pushpin-bottom="Infinity">
<ul id="sidebarMenu" class="menu">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</div></code></pre>
</div>
<div class="row" id="dropdown">
<h2 class="header">Dropdown</h2>
<p>The dropdown attribute in the below makes sure that the jQuery plugin is run.</p>
<p>You can set attributes on the tag, matching the names of the options in the <a href="http://materializecss.com/dropdown.html#!">materializeCSS's version</a>.</p>
</div>
<div class="row">
<div class="section col s4">
<!-- Dropdown Trigger -->
<a class='dropdown-button btn' href='javascript:void(0);' data-activates='demoDropdown' dropdown data-hover="true">
This is a dropdown
</a>
<!-- Dropdown Structure -->
<ul id='demoDropdown' class='dropdown-content'>
<li><a href="javascript:void(0);">Link 1</a></li>
<li><a href="javascript:void(0);">Link 2</a></li>
<li><a href="javascript:void(0);">Link 3</a></li>
<li><a href="javascript:void(0);">Link 4</a></li>
<li><a href="javascript:void(0);">Link 5</a></li>
</ul>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<!-- Dropdown Trigger -->
<a class='dropdown-button btn' href='javascript:void(0);' data-activates='demoDropdown' dropdown data-hover="true">
This is a dropdown
</a>
<!-- Dropdown Structure -->
<ul id='demoDropdown' class='dropdown-content'>
<li><a href="javascript:void(0);">Link 1</a></li>
<li><a href="javascript:void(0);">Link 2</a></li>
<li><a href="javascript:void(0);">Link 3</a></li>
<li><a href="javascript:void(0);">Link 4</a></li>
<li><a href="javascript:void(0);">Link 5</a></li>
</ul></code></pre>
</div>
<!-- TODO: Make it clear what the different options do, especially 'open' -->
<div class="row" id="modals" ng-init="dummyInputs.modalInput = 'Modal header'" ng-controller="ModalController">
<h2 class="header">Modals</h2>
<p>You need a modal trigger, like the below. The trigger should have the modal directive, and the href attribute must point to the ID of the modal structure. <br />
The modal strcture should be structured <a href="http://materializecss.com/modals.html">just like in materialize</a>. <br>
In the below example, you can change the header of the modal through the input field. </p>
<!-- Modal Trigger -->
<div class="col">
<a class='btn' data-target='demoModal' modal ready="readyCallback()" complete="completeCallback()" open="openModal">Show Modal</a>
</div>
<div input-field class="col s4">
<input type="text" ng-model="dummyInputs.modalInput">
<label>Modal header</label>
</div>
<div class="col s4">
<a class='btn' ng-click="openModal = true">Open from controller</a>
</div>
<!-- Modal Structure -->
<div id="demoModal" class="modal">
<div class="modal-content">
<h4>{{dummyInputs.modalInput}}</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable><!-- Modal Trigger -->
<div class="col">
<a class='btn' data-target='demoModal' modal>Show Modal</a>
</div>
<!-- Modal Structure -->
<div id="demoModal" class="modal">
<div class="modal-content">
<h4>Modal header</h4>
<p>A bunch of text</p>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Agree</a>
</div>
</div></code></pre>
</div>
<div class="row">
<h4>Tabs</h4>
<p>If you are going to use <a href="#tabs">tabs</a> in a modal you will need to add the <code class="language-markup">enable-tabs</code> attribute to your modal trigger.</p>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable><!-- Modal Trigger -->
<div class="col">
<a class='btn' data-target='demoModal' enable-tabs="true" modal>Show Modal</a>
</div></code></pre>
</div>
<div class="row" id="parallax" ng-init="showParallax = true">
<h2 class="header">Parallax</h2>
<p>Adding the parallax attribute makes sure that <a href="http://materializecss.com/parallax.html">the jQuery plugin from Materialize</a> is run.</p>
<p>It works just like the code below the image shows, and fills the entire width of the container it is put in. </p>
<a class="btn waves-effect waves-light" ng-click="showParallax = !showParallax">Show/hide the below parallax</a>
</div>
</div>
<div class="parallax-container" ng-if="showParallax" style="margin: 20px 0;">
<div parallax><img src="images/parallax1.jpg"></div>
</div>
<div class="container">
<div class="row">
<pre><code class="language-markup" ng-non-bindable><div class="parallax-container">
<div parallax><img src="images/parallax1.jpg"></div>
</div></code></pre>
</div>
<div class="row" id="scrollfire">
<h2 class="header" scroll-fire="toast('Past scoll-fire', 2000)" offset="500">ScrollFire</h2>
<p>It's previously stated that this library is mostly wrappers for Materialize code. <br/>This directive is an exception, since the Materialize code for ScrollFire is crap (as of version 0.97.5). </p>
<p>ScrollFire is very simple, you set an attribute <code class="language-markup">scoll-fire</code> on some attribute, with a callback. And this callback fires when the user scrolls past that element. <br />
One can further set an <code class="language-markup">offset</code> attribute, to make the callback fire after the user has scrolled a certain amount of pixels beyond the element.</p>
<p>If you look at the source of this directive, it is used to alert a message after the user has scrolled 500 pixels past the "ScrollFire" header. <br/>
And the code below shows the source-code for that header. That example requires an <code class="language-javascript">toast</code> function to be defined on the scope. </p>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable><h2 class="header" scroll-fire="toast('Past scoll-fire', 2000)" offset="500">ScrollFire</h2></code></pre>
</div>
<div class="row" id="sidenav">
<h2 class="header">Sidenav</h2>
<p>Make sure to have a side-menu with id corresponding to the argument <code class="language-markup">data-activates</code>. </p>
<p>If you copy this page, there is another side-nav link in the top of the page, which initializes first and therefore sets the options. </p>
<p>If you add the class <code class="language-markup">button-collapse</code> the button will only show when the side-menu is hidden. <br/>
This is not done on the below button, for demonstration purposes, although it is added in the code example.</p>
</div>
<div class="row">
<a href="#" data-activates="nav-mobile" class="top-nav btn waves-effect waves-light" data-sidenav="left" data-closeonclick="false">
Show side-nav
</a>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<a href="#" class="button-collapse" data-activates="nav-mobile" data-sidenav="left" data-menuwidth="500" data-closeonclick="false">
Show side-nav
</a></code></pre>
</div>
<div class="row" id="slider">
<h2 class="header">Slider</h2>
<p>An extremely simple directive, that just enables the slider. Just add the attribute <code class=" language-markup" data-language="markup">slider</code>, and the slider will be initialized. </p>
<p>You can optionally set one of more of the attributes <code class=" language-markup" data-language="markup">height</code>, <code class=" language-markup" data-language="markup">transition</code>,
<code class=" language-markup" data-language="markup">interval</code> or <code class=" language-markup" data-language="markup">indicators</code>, and the option will be passed to the slider. <br />
Like so: <code class=" language-markup" data-language="markup"><div slider height='500' transition='400'></div></code><br />
The options correspond to the ones in the <a href="http://materializecss.com/media.html#slider">Materialize documentation</a></p>
</div>
<div class="row">
<div slider>
<ul class="slides">
<li>
<img src="images/nature1.jpg">
<div class="caption center-align">
<h3>This is our big Tagline!</h3>
<h5 class="light grey-text text-lighten-3">Here's our small slogan.</h5>
</div>
</li>
<li>
<img src="images/nature2.jpg">
<div class="caption left-align">
<h3>Left Aligned Caption</h3>
<h5 class="light grey-text text-lighten-3">Here's our small slogan.</h5>
</div>
</li>
<li>
<img src="images/nature3.jpg">
<div class="caption right-align">
<h3>Right Aligned Caption</h3>
<h5 class="light grey-text text-lighten-3">Here's our small slogan.</h5>
</div>
</li>
<li>
<img src="images/nature4.jpg">
<div class="caption center-align">
<h3>This is our big Tagline!</h3>
<h5 class="light grey-text text-lighten-3">Here's our small slogan.</h5>
</div>
</li>
</ul>
</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable><div class="slider" slider>
<ul class="slides">
<li>
<img src="http://lorempixel.com/580/250/nature/1"> <!-- random image -->
<div class="caption center-align">
<h3>This is our big Tagline!</h3>
<h5 class="light grey-text text-lighten-3">Here's our small slogan.</h5>
</div>
</li>
<li>
<img src="http://lorempixel.com/580/250/nature/2"> <!-- random image -->
<div class="caption left-align">
<h3>Left Aligned Caption</h3>
<h5 class="light grey-text text-lighten-3">Here's our small slogan.</h5>
</div>
</li>
<li>
<img src="http://lorempixel.com/580/250/nature/3"> <!-- random image -->
<div class="caption right-align">
<h3>Right Aligned Caption</h3>
<h5 class="light grey-text text-lighten-3">Here's our small slogan.</h5>
</div>
</li>
<li>
<img src="http://lorempixel.com/580/250/nature/4"> <!-- random image -->
<div class="caption center-align">
<h3>This is our big Tagline!</h3>
<h5 class="light grey-text text-lighten-3">Here's our small slogan.</h5>
</div>
</li>
</ul>
</div></code></pre>
</div>
<div class="row" id="media">
<h2 class="header">Media</h2>
<p class="caption">Materialbox is intialized automatically. However, if you add images dynamically, you will have to add this initialization code.</p>
<div class="material-placeholder"><img materialboxed class="materialboxed responsive-img " width="650" src="images/sample-1.jpg"></div>
</div>
<div class="row">
<p>Creating the above image with the effect is as simple as adding a class to the image tag.</p>
<pre><code class="language-markup" ng-non-bindable>
<img materialboxed class="materialboxed responsive-img" width="650" src="images/sample-1.jpg">
</code></pre>
</div>
<div class="row">
<h4>Captions</h4>
<p>It is very easy to add a short caption to your photo. Just add the caption as a <code class=" language-markup">data-caption</code> attribute.</p>
<div class="material-placeholder"><img materialboxed class="materialboxed" data-caption="A picture of some deer and tons of trees" width="250" src="images/nature_portrait_by_pw_fotografie-d63tx0n.jpg"></div>
</div>
<div class="row">
<p>Creating the above image with the effect is as simple as adding a class to the image tag.</p>
<pre><code class="language-markup" ng-non-bindable>
<img materialboxed class="materialboxed" data-caption="A picture of some deer and tons of trees" width="250" src="iamges/nature_portrait_by_pw_fotografie-d63tx0n.jpg">
</code></pre>
<div class="row" id="tabs" ng-init="showTabs = true">
<h2 class="header">Tabs</h2>
<p>This is a very simple directive, that just calls the jQuery plugin when the element is initialized.</p>
<p>For the styling to work, you still need to have the class <code class="language-markup">tabs</code> on the <code class="language-markup">ul</code> tag</p>
<p>Because of the simple implementation, don't expect ng-repeat ng-model or similar to work inside the ul of the tabs (should work inside the content though).</p>
<p>It is possible to trigger reload of tabs manually with a simple boolean property on your scope. It can be useful when you want to load your content dynamically with <code class="language-markup">ng-include</code> or so.</p>
<a class="btn waves-effect waves-light" ng-click="showTabs = !showTabs">Show/hide the below tabs</a>
</div>
<div class="row" ng-if="showTabs">
<div class="col s12">
<ul tabs>
<li class="tab col s3"><a href="#test1">Test 1</a></li>
<li class="tab col s3"><a class="active" href="#test2">Test 2</a></li>
<li class="tab col s3"><a href="#test3">Test 3</a></li>
<li class="tab col s3"><a href="#test4">Test 4</a></li>
</ul>
</div>
<div id="test1" class="col s12">Test 1</div>
<div id="test2" class="col s12">Test 2</div>
<div id="test3" class="col s12">Test 3</div>
<div id="test4" class="col s12">Test 4</div>
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable>
<div class="row" ng-if="showTabs">
<div class="col s12">
<ul tabs reload="allTabContentLoaded">
<li class="tab col s3"><a href="#test1">Test 1</a></li>
<li class="tab col s3"><a class="active" href="#test2">Test 2</a></li>
<li class="tab col s3"><a href="#test3">Test 3</a></li>
<li class="tab col s3"><a href="#test4">Test 4</a></li>
</ul>
</div>
<div id="test1" class="col s12">Test 1</div>
<div id="test2" class="col s12">Test 2</div>
<div id="test3" class="col s12">Test 3</div>
<div id="test4" class="col s12">Test 4</div>
</div></code></pre>
</div>
<div class="row" id="pagination">
<h2 class="header">Pagination</h2>
<p>This is only the pagination buttons, it doesn't do anything to change the page. That you'll have to do in the callback</p>
<p>In the below, changePage is a function defined on the controller. </p>
<p>Pr. default the prev/next buttons are icons from <a href="http://google.github.io/material-design-icons/">Material design icons</a>, which needs to be included, like this: <code class="language-markup"><link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"></code> <br/>
It is also possible to set the option <code class="language-markup">use-simple-prev-next</code> to false, in which case simple ">" chars will be used.
</p>
</div>
<div class="row" ng-controller="PaginationController">
<pagination
page="1"
page-size="10"
total="200"
show-prev-next="true"
dots="...."
use-simple-prev-next="false"
hide-if-empty="false"
adjacent="2"
scroll-top="false"
pagination-action="changePage(page)" />
</div>
<div class="row">
<pre><code class="language-markup" ng-non-bindable><pagination
page="1"
page-size="10"
total="200"
show-prev-next="true"
use-simple-prev-next="false"
dots="...."
hide-if-empty="false"
adjacent="2"
scroll-top="false"
pagination-action="changePage(page)" /></code></pre>
</div>
</div>
</div>
</main>
</body>
</html>