-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathindex.html
2110 lines (1968 loc) · 87.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
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<!-- <meta http-equiv="X-UA-Compatible" content="chrome=1"> -->
<title>angular-confirm.js | The multipurpose alert & confirm</title>
<meta name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<meta name="description"
content="A multipurpose alert, confirm plugin, alternative to the native alert() and confirm() functions. Supports features like auto-close, themes, animations, and more.">
<link rel="canonical"
href="https://craftpip.github.io/angular-confirm"/>
<link rel="icon"
type="img/png"
href="http://craftpip.com/i/assets/img/fav.png">
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"/>
<meta name="robots"
content="index,follow,noodp,noydir"/>
<meta name="google-site-verification"
content="T_M_Ym5DQ-cEQQhx_jswyCBTssIdgtewICcvb3sgh8g"/>
<meta name="Keywords"
content="angular.confirm, angular confirm, angular alert, angular prompt, angular dialog, javascript, bootstrap"/>
<link rel="apple-touch-icon"
sizes="57x57"
href="http://craftpip.com/i/apple-touch-icon-57x57.png"/>
<link rel="apple-touch-icon"
sizes="72x72"
href="http://craftpip.com/i/apple-touch-icon-72x72.png"/>
<link rel="apple-touch-icon"
sizes="114x114"
href="http://craftpip.com/i/apple-touch-icon-114x114.png"/>
<link rel="apple-touch-icon"
sizes="144x144"
href="http://craftpip.com/i/apple-touch-icon-144x144.png"/>
<link rel="apple-touch-icon"
href="http://craftpip.com/i/apple-touch-icon-57x57.png"/>
<meta property="og:title"
content="angular-confirm.js | The multipurpose alert & confirm"/>
<meta property="og:type"
content="website"/>
<meta property="og:image"
content="http://craftpip.com/i/apple-touch-icon-57x57.png"/>
<meta property="og:url"
content="https://craftpip.github.io/angular-confirm"/>
<meta property="og:description"
content="A multipurpose alert & confirm plugin, alternative to the native alert() and confirm() functions. Supports features like auto-close, themes, animations, and more."/>
<meta property="og:site_name"
content="craftpip.github.io"/>
<link rel="stylesheet"
href="demo/libs/bundled.css">
<script src="demo/libs/bundled.js"></script>
<link rel="stylesheet"
href="demo/demo.css">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
var version = '1.1.0';
</script>
<!-- Add the minified version of files from the /dist/ folder. -->
<!-- angular-confirm files -->
<link rel="stylesheet"
type="text/css"
href="css/angular-confirm.css"/>
<script type="text/javascript"
src="js/angular-confirm.js"></script>
<!--END angular-confirm files-->
</head>
<body data-spy="scroll"
data-target=".navbar">
<header class="navbar navbar-static-top navbar-default navheader">
<div class="container">
<div class="navbar-header">
<button class="navbar-toggle collapsed"
type="button"
data-toggle="collapse"
data-target="#bs-navbar"
aria-controls="bs-navbar"
aria-expanded="false"><span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span></button>
<a class="navbar-brand aconfirm-logo"
href="http://craftpip.github.io/angular-confirm">
</a>
</div>
<nav id="bs-navbar"
class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class=""><a href="http://github.com/craftpip/angular-confirm"><i class="fa fa-github"></i> Project
home</a></li>
<li class=""><a href="http://github.com/craftpip/angular-confirm/issues/new">Suggest feature</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#"
class="dropdown-toggle"
data-toggle="dropdown"
role="button"
aria-haspopup="true"
aria-expanded="false">Versions <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="http://craftpip.github.io/angular-confirm/v1.0.1">v1.0.1</a></li>
<li><a href="http://craftpip.github.io/angular-confirm/v1.0">v1.0</a></li>
</ul>
</li>
<li>
<a class="github-button"
href="https://github.com/craftpip/angular-confirm"
data-style="mega"
data-count-href="/craftpip/angular-confirm/stargazers"
data-count-api="/repos/craftpip/angular-confirm#stargazers_count"
data-count-aria-label="# stargazers on GitHub"
aria-label="Star craftpip/angular-confirm on GitHub">Star</a>
</li>
<li>
<a class="twitter-follow-button"
data-show-count="false"
data-size="large"
href="https://twitter.com/craftpip"
data-show-count="false"
data-lang="en">
Follow @craftpip
</a>
</li>
</ul>
</nav>
</div>
</header>
<div class="header"
id="content"
tabindex="-1">
<div class="container">
<h1 style="margin-top: 7px;"
class="text-center">
<img src="angular-confirm.png"
alt="ANGULAR-CONFIRM"/>
</h1>
<p>
<em>alerts</em>, <em>confirms</em> and <em>dialogs</em> in <strong>one</strong>.
</p>
<div class="row download-btns">
<div class="col-md-12">
<div style="height: 15px;"></div>
<a href="https://github.com/craftpip/angular-confirm/releases/download/v1.1.0/angular-confirm-v1.1.0.zip"
class="btn btn-lg">Download v1.1.0
</a>
<a href="https://github.com/craftpip/angular-confirm"
class="btn btn-lg"><i class="fa fa-github"></i> View on GitHub
</a>
<div style="height: 15px;"></div>
</div>
</div>
</div>
</div>
<div class="container"
ng-app="application">
<div ng-controller="adsController"></div>
<div class="row">
<div class="col-md-3 col-sm-12">
<div class="space10"></div>
<div class="space10"></div>
<p>
<strong>angular-confirm v<span class="version"></span> docs</strong><br>
<a href="https://github.com/craftpip/angular-confirm">
view on <i class="fa fa-github"></i> Github
</a>
</p>
<div class="spacer15"></div>
<div id="my-nav">
<ul class="nav nav-list">
<li>
<a href="#quickfeatures"> Features</a>
</li>
<li>
<a href="#getting-started"> Getting started</a>
<ul class="nav nav-list">
<li>
<a href="#installation"> Installation</a>
</li>
<li>
<a href="#usage"> Basic usage</a>
</li>
<li>
<a href="#using-templates"> Using templates</a>
</li>
<li>
<a href="#shorthand"> Shorthand usage</a>
</li>
</ul>
</li>
<li>
<a href="#buttons">Buttons</a>
<ul class="nav nav-list">
<li>
<a href="#defining-buttons">Defining buttons</a>
</li>
<li>
<a href="#buttontext">Text</a>
</li>
<li>
<a href="#buttonstyle">Styles</a>
</li>
<li>
<a href="#button-keys">Keys</a>
</li>
<li>
<a href="#button-properties">Properties</a>
</li>
</ul>
</li>
<li>
<a href="#customizing">Customizing</a>
<ul class="nav nav-list">
<li>
<a href="#dialog-type"> Dialog type</a>
</li>
<li>
<a href="#icons"> Icons</a>
</li>
<li>
<a href="#close-icon"> Close icon</a>
</li>
<li>
<a href="#custom-width"> Custom width</a>
</li>
<li>
<a href="#custom-width-without-bootstrap"> Custom width w/o bootstrap</a>
</li>
<li>
<a href="#namespaced-bootstrap"> Namespaced bootstrap</a>
</li>
</ul>
</li>
<li>
<a href="animations.html"> Animations <span style="margin-left: 5px;"><i class="fa fa-external-link"></i></span></a>
<ul class="nav nav-list">
<li>
<a href="#animations">Animations</a>
</li>
</ul>
</li>
<li>
<a href="themes.html"> Themes <span style="margin-left: 5px;"><i class="fa fa-external-link"></i></span></a>
<ul class="nav nav-list">
<li>
<a href="#themes">Themes</a>
</li>
</ul>
</li>
<li>
<a href="#autoclose"> Auto close</a>
</li>
<li>
<a href="#backgrounddismiss"> Background dismiss</a>
<ul class="nav nav-list">
<li>
<a href="#backgrounddismiss"> Background dismiss</a>
</li>
<li>
<a href="#backgrounddismiss-animations">Dismiss animations</a>
</li>
</ul>
</li>
<li>
<a href="#escape-key"> Escape key</a>
</li>
<li>
<a href="#rtl"> RTL Support</a>
</li>
<li>
<a href="#callbacks"> Callbacks</a>
</li>
<li>
<a href="#globaldefaults"> Global defaults</a>
</li>
<li>
<a href="#options"> Options</a>
</li>
<li>
<a href="#api"> Api</a>
<ul class="nav nav-list">
<li>
<a href="#api-scope"> .scope</a>
</li>
<li>
<a href="#api-button-text"> .<buttonName>.setText</a>
</li>
<li>
<a href="#api-button-class"> .<buttonName>.setBtnClass</a>
</li>
<li>
<a href="#api-button-disable"> .<buttonName>.setDisabled</a>
</li>
<li>
<a href="#api-button-show"> .<buttonName>.setShow</a>
</li>
<li>
<a href="#api-close"> .close()</a>
</li>
<li>
<a href="#api-isclosed"> .isClosed()</a>
</li>
<li>
<a href="#api-isopen"> .isOpen()</a>
</li>
<li>
<a href="#api-setdialogcenter"> .setDialogCenter()</a>
</li>
<li>
<a href="#api-el"> .$el</a>
</li>
<li>
<a href="#api-confirm-box"> .$confirmBox</a>
</li>
<li>
<a href="#api-set-theme"> .setTheme</a>
</li>
<li>
<a href="#api-set-type"> .setType</a>
</li>
<li>
<a href="#api-set-type-animated"> .setTypeAnimated</a>
</li>
<li>
<a href="#api-set-title-class"> .setTitleClass</a>
</li>
<li>
<a href="#api-set-box-width"> .setBoxWidth</a>
</li>
<li>
<a href="#api-set-container-fluid"> .setContainerFluid</a>
</li>
<li>
<a href="#api-set-column-class"> .setColumnClass</a>
</li>
<li>
<a href="#api-set-icon"> .setIcon</a>
</li>
<li>
<a href="#api-set-title"> .setTitle</a>
</li>
<li>
<a href="#api-set-close-icon"> .setCloseIcon</a>
</li>
<li>
<a href="#api-set-close-icon-class"> .setCloseIconClass</a>
</li>
<li>
<a href="#api-trigger-button"> .triggerButton</a>
</li>
<li>
<a href="#api-set-rtl"> .setRtl</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="col-md-9 col-sm-12">
<!-- introduction -->
<!-- angular-confirm home top -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-9535136378177592"
data-ad-slot="2996895260"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<section>
<header>
<h3>Welcome to angular-confirm!</h3>
<p>
The quickest way to build modals with angular <br/>
angular-confirm manages the scope, you don't need to worry about anything, <br>
so that you can throw in a template and render stuff right away. <br>
This project is a re-write of the <a href="https://github.com/craftpip/jquery-confirm">jquery-confirm</a> plugin
</p>
<a href="https://github.com/craftpip/angular-confirm/issues"
target="empty"
class="btn btn-success"><i class="fa fa-bug fa-fw"></i> Please post your Suggestions here.</a>
</header>
</section>
<hr>
<section id="quickfeatures" ng-controller="quickFeaturesController">
<h2>Features</h2>
<p>These features can practically be used like so.</p>
<div class="row">
<div class="col-md-3">
<button ng-click="alert()" class="btn btn-primary btn-block">Alerts</button>
<p class="text-success">Elegant Alerts.</p>
</div>
<div class="col-md-3">
<button ng-click="confirm()" class="btn btn-primary btn-block ">Confirmation</button>
<p class="text-success">Stacked Confirmations</p>
</div>
<div class="col-md-3">
<button ng-click="type()" class="btn btn-primary btn-block">Alert types
</button>
<p class="text-success">Success, error, warning</p>
</div>
<div class="col-md-3">
<button ng-click="prompt()" class="btn btn-primary btn-block">Prompt</button>
<p class="text-success">Need input?</p>
</div>
</div>
<div class="row">
<div class="col-md-3">
<button ng-click="dialog()" class="btn btn-primary btn-block">Dialogs</button>
<p class="text-success">Its also a Dialog.</p>
</div>
<div class="col-md-3">
<button ng-click="bgDismiss()" class="btn btn-primary btn-block">Background
dismiss
</button>
<p class="text-success">Not so important modal</p>
</div>
<div class="col-md-3">
<button ng-click="asyncContent()" class="btn btn-primary btn-block">Asynchronous
content
</button>
<p class="text-success">Loading from remote places</p>
</div>
<div class="col-md-3">
<button ng-click="autoClose()" class="btn btn-primary btn-block">Auto-close</button>
<p class="text-success">Some actions maybe critical</p>
</div>
</div>
<div class="row">
<div class="col-md-3">
<button ng-click="keyStrokes()" class="btn btn-primary btn-block">Keystrokes
</button>
<p class="text-success">Responds to keystrokes</p>
</div>
<div class="col-md-3">
<button ng-click="centerAlign()" class="btn btn-primary btn-block">Alignment
</button>
<p class="text-success">Automatically centered</p>
</div>
<div class="col-md-3">
<button ng-click="imageLoading()" class="btn btn-primary btn-block">Images</button>
<p class="text-success">Loading images</p>
</div>
<div class="col-md-3">
<button ng-click="videos()" class="btn btn-primary btn-block">Videos</button>
<p class="text-success">Youtube videos</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<h3>Themes</h3>
<p>
angular-confirm comes loaded with 7 different themes, for all common use cases.
</p>
</div>
<div class="col-md-3">
<button ng-click="materialTheme()" class="btn btn-info btn-block">Material theme
</button>
</div>
<div class="col-md-3">
<button ng-click="modernTheme()" class="btn btn-info btn-block">Modern theme
</button>
</div>
<div class="col-md-3">
<button ng-click="supervanTheme()" class="btn btn-info btn-block">Supervan theme
</button>
</div>
<div class="col-md-3">
<a href="themes.html" class="btn btn-default btn-block">more themes</a>
</div>
</div>
</section>
<section>
<h2>Whats new <span style="color: #aaa">in v1.1.0</span></h2>
<ul>
<li>Performance fixes</li>
<li>Removed ngSanitize & ngAnimate dependencies</li>
</ul>
</section>
<!-- Installation -->
<section id="getting-started">
<h2>Getting started</h2>
<h3 id="installation">
Installation
</h3>
<div class="section">
<p>
<strong>Download</strong>
<br>
Download the Latest version and use files in the <code>/dist/</code> folder.
</p>
<p>
<strong>via Bower:</strong>
<br>
<code>
$ bower install angular1-confirm
</code>
</p>
<!--<p>-->
<!--<strong>via Npm:</strong>-->
<!--<br>-->
<!--<code>-->
<!--$ npm install angular-confirm-->
<!--</code>-->
<!--</p>-->
<p>
<strong>Dependencies:</strong>
</p>
<ul>
<li>Angular >= 1.5</li>
<li>Bootstrap by Twitter >= v3 (optional, if you want to use responsive layouts)</li>
<li>jQuery library >= v1.8</li>
</ul>
<div class="alert alert-info">
<i class="fa fa-info fa-fw"></i> to use ngConfirm without bootstrap set <code>useBootstrap:
false</code>
</div>
</div>
</section>
<!-- basic usage -->
<section id="usage" ng-controller="quickUseController">
<h3>Basic Usage</h3>
<div class="section">
<div class="row">
<div class="col-md-12">
<h4 id="module_dependency">
Add the module dependency in your app
</h4>
</div>
<div class="col-md-12">
<pre class="prettyprint linenums"><code class="js">angular.module('myModule', ['cp.ngConfirm'])</code></pre>
</div>
<div class="col-md-12">
<h4 id="confirm">
$ngConfirm
</h4>
</div>
<div class="col-md-12">
<p>
A basic usage of ngConfirm, <br>
This pretty much explains how it works, content is the template that will be shown
inside the popup.
<br>
<p class="text-warning">
If $scope is not provided, ngConfirm will create a child scope from
rootScope & the created scope will be destroyed when modal is closed.</p>
</p>
<button ng-click="test()" class="btn btn-primary">test()</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="js" ng-non-bindable>.controller('myController', function ($scope, $ngConfirm) {
$scope.test = function(){
$scope.name = 'Sia: cheap thrills';
$ngConfirm({
title: 'Confirm!',
content: '<strong>{{name}}</strong> is my favourite song',
scope: $scope,
buttons: {
sayBoo: {
text: 'Say Booo',
btnClass: 'btn-blue',
action: function(scope, button){
scope.name = 'Booo!!';
return false; // prevent close;
}
},
somethingElse: {
text: 'Something else',
btnClass: 'btn-orange',
action: function(scope, button){
$ngConfirm('You clicked on <strong>something else</strong>');
}
}
close: function(scope, button){
// closes the modal
},
}
});
}
});</code></pre>
</div>
<div class="col-md-12">
<h4 id="using-templates">
using templates (contentUrl)
</h4>
</div>
<div class="col-md-12">
<p>
contentUrl is basically templateUrl, which is fetched and compiled with scope. <br>
if contentUrl is provided content property is ignored.
</p>
<pre class="prettyprint linenums"><code class="js" ng-non-bindable>.controller('myController', function ($scope, $ngConfirm) {
$scope.usingTemplates = function(){
$ngConfirm({
title: 'Confirm!',
contentUrl: 'my_template.html',
scope: $scope,
...
});
}
});</code></pre>
</div>
<div class="col-md-12">
<h4 id="shorthand">Shorthand usage</h4>
<p>
The shorthand thingy is made so that you don't need to define everything again. <br>
There are 4 variants for passing the arguments.
</p>
<pre class="prettyprint linenums"><code class="js">$ngConfirm('Content here');
$ngConfirm('Content here', $scope);
$ngConfirm('Content here', 'Title here');
$ngConfirm('Content here', 'Title here', $scope);</code></pre>
</div>
</div>
</div>
</section>
<section id="buttons" ng-controller="buttonController">
<h2>Buttons</h2>
<p>
Its all what you need to know about buttons in ngConfirm.
</p>
<h4 id="defining-buttons">
Definition
</h4>
<div class="section">
<p>
Buttons can be defined in the following fashion, pretty self explanatory.
</p>
<pre class="prettyprint linenums"><code class="html" ng-non-bindable>$ngConfirm({
buttons: {
hello: function(scope, button){
// button action
},
hey: function(scope, button){
button.setDisabled(true); // disable the current button.
button.setText('heyyyy'); // change the current button text.
this.triggerButton('hello'); // this triggers the other button named hello.
this.buttons.heyThere.setDisabled(true); // disable the hello button.
},
heyThere: {
text: 'Hey there!',
btnClass: 'btn-blue',
keys: ['enter', 'a'],
action: function(scope, button){
// button action
}
}
}
});</code></pre>
</div>
<h4 id="buttontext">Button text</h4>
<div class="section">
<button ng-click="buttonText()" class="btn btn-primary">click me!</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="html" ng-non-bindable>$ngConfirm({
buttons: {
something: function(){
// here the key 'something' will be used as the text.
$ngConfirm('You clicked on something.');
},
somethingElse: {
text: 'Something else &*', // Some Non-Alphanumeric characters
action: function(){
$ngConfirm('You clicked on something else');
}
}
}
})</code></pre>
</div>
<h4 id="buttonstyle">Button style</h4>
<div class="section">
<p>Simply applying classes to buttons.</p>
<p class="text-info">
ngConfirm comes bundled with <code>btn-blue</code> <code>btn-green</code> <code>btn-red</code>
<code>btn-orange</code> <code>btn-purple</code> <code>btn-default</code> <code>btn-dark</code>
</p>
<p class="text-info">
Other bootstrap options are <code>btn-primary</code> <code>btn-inverse</code>
<code>btn-warning</code>
<code>btn-info</code> <code>btn-danger</code> <code>btn-success</code>
</p>
<button ng-click="usingNgConfirmButtons()" class="btn btn-primary">Using buttons that come with
ngConfirm!
</button>
<button ng-click="usingBootstrapButtons()" class="btn btn-primary">Using bootstrap buttons!</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="html">$ngConfirm({
buttons: {
default: {
btnClass: 'btn-default',
...
},
blue: {
btnClass: 'btn-blue',
...
},
green: {
btnClass: 'btn-green',
...
},
}
});</code></pre>
</div>
<h4 id="button-keys">Button keys</h4>
<div class="section">
<p>
Listen to keyup events for individual buttons. A button can listen for multiple keys at a time.
</p>
<div class="alert alert-info">
Available options are: <br>
a to Z, tilde, enter, shift, tab, capslock, ctrl, win, alt, esc, space.
</div>
<button ng-click="buttonKeys()" class="btn btn-primary">Click me!</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="html">$ngConfirm({
buttons: {
specialKey: {
text: 'On behalf of shift',
keys: ['shift', 'alt'],
action: function(){
$ngConfirm('Shift or Alt was pressed');
}
},
alphabet: {
text: 'A, B',
keys: ['a', 'b'],
action: function(){
$ngConfirm('A or B was pressed');
}
}
}
});</code></pre>
<button type="button"
ng-click="buttonKeysExample()"
class="btn btn-primary">Another important example
</button>
<div class="space10"></div>
<p>
In this example, the YES button is hidden using bootstrap's hide class, thus the user can only
use keys to proceed.
</p>
<pre class="prettyprint linenums"><code class="html">$ngConfirm({
title: false,
content: 'A very very critical action here! <br> ' +
'the proceed button is hidden.' +
'The only way to proceed is to press the <strong>Y</strong> key.<br>' +
'Press <span style="font-size: 20px;">Y</span> to proceed.',
buttons: {
yes: {
show: false, // hides the button using display: none
keys: ['y'],
action: function (scope, button) {
$ngConfirm('Critical action <strong>was performed</strong>.');
}
},
no: {
keys: ['N'],
action: function (scope, button) {
$ngConfirm('You clicked No.');
}
},
}
});</code></pre>
</div>
<h4 id="button-properties">Button properties</h4>
<div class="section">
<p>
Button properties provide a nice and clean way to alter your buttons in run-time.
</p>
<button ng-click="buttonProperties()" class="btn btn-primary">Try me</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code class="html">$ngConfirm({
buttons: {
buttonA: {
text: 'button a',
action: function (scope, button) {
button.setText('Oh yeah'); // the current button
this.buttons.buttonB.setText('Changed it!');
return false;
}
},
buttonB: {
text: 'button b',
action: function (scope, button) {
this.buttons.buttonA.setDisabled(true);
return false;
}
},
reset: function (scope, button) {
this.buttons.buttonA.setDisabled(false);
this.buttons.buttonA.setText('button a');
this.buttons.buttonB.setText('button b');
return false;
}
},
});</code></pre>
<p>
A full list of functions for buttons.
</p>
<table class="table table-bordered table-condensed">
<tr>
<td>
Function
</td>
<td>
Code
</td>
<td>
Description
</td>
</tr>
<tr>
<td>
setText
</td>
<td>
this.buttons.<buttonName>.setText('text')
</td>
<td>
The text you want to set.
</td>
</tr>
<tr>
<td>
setBtnClass
</td>
<td>
this.buttons.<buttonName>.setBtnClass('btn-info')
</td>
<td>
Change the button's class.
</td>
</tr>
<tr>
<td>
setDisabled
</td>
<td>
this.buttons.<buttonName>.setDisabled(Boolean)
</td>
<td>
enable or disable a button
</td>
</tr>
<tr>
<td>
setShow
</td>
<td>
this.buttons.<buttonName>.setShow(Boolean)
</td>
<td>
Show or hide the button via CSS
</td>
</tr>
</table>
</div>
</section>
<section id="customizing" ng-controller="customizationController">
<h2>Customizing</h2>
<h4 id="dialog-type">Dialog type</h4>
<div class="section">
<p>
Dialog types helps give the user a hint as to what the dialog is about
</p>
<button ng-click="errorDialog()" class="btn btn-primary">Error/Red dialog</button>
<button ng-click="successDialog()" class="btn btn-primary">Success/Green dialog</button>
<button ng-click="errorDialogNoAnimation()" class="btn btn-primary">Non animated type dialog
</button>
<div class="space10"></div>
<button ng-click="dialogType('orange')" class="btn btn-primary">orange</button>
<button ng-click="dialogType('blue')" class="btn btn-primary">blue</button>
<button ng-click="dialogType('purple')" class="btn btn-primary">purple</button>
<button ng-click="dialogType('dark')" class="btn btn-primary">dark</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code>$ngConfirm({
title: 'Encountered an error!',
content: 'Something went downhill, this may be serious',
type: 'red',
typeAnimated: true,
buttons: {
tryAgain: {
text: 'Try again',
btnClass: 'btn-red',
action: function(){
}
},
close: function () {
}
}
});</code></pre>
</div>
<h4 id="icons">Icons</h4>
<div class="section">
<p>Give meaning to your dialog with custom icons.<br>
Read about Font Awesome
<a href="http://fortawesome.github.io/Font-Awesome">here</a>
.
</p>
<button ng-click="iconFA()" class="btn btn-primary">Using font-awesome</button>
<button ng-click="iconAnimatedFA()" class="btn btn-primary">Animated font-awesome</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code>$ngConfirm({
icon: 'glyphicon glyphicon-heart',
title: 'glyphicon'
});
$ngConfirm({
icon: 'fa fa-warning',
title: 'font-awesome'
});
$ngConfirm({
icon: 'fa fa-spinner fa-spin',
title: 'Working!',
content: 'Sit back, we are processing your request!'
});</code></pre>
</div>
<h4 id="close-icon">Close icon</h4>
<div class="section">
<p>
ngConfirm confirm uses <code>&times;</code> html entity for this close symbol, however you
can
use Any icon of your choice (fa, glyphicon, zmdi)
</p>
<div class="alert alert-info">
By default <code>closeIcon</code> is set to <code>null</code>.
That means, if buttons are not defined the closeIcon will be shown, else will not be shown.
<br>
To explicitly show <code>closeIcon</code> set it to a truthy value and vise versa.
</div>
<div class="row">
<div class="col-md-6">
<p>
Turn on closeIcon explicitly
</p>
<button ng-click="closeIcon()" class="btn btn-primary">With closeIcon</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code>$ngConfirm({
closeIcon: true
});</code></pre>
</div>
<div class="col-md-6">
<p>
Using other libraries for icons
</p>
<button ng-click="closeIconFa()" class="btn btn-primary">Using font awesome</button>
<div class="space10"></div>
<pre class="prettyprint linenums"><code>$ngConfirm({
closeIcon: true,
closeIconClass: 'fa fa-close'
});</code></pre>
</div>
</div>
<h4>
<i class="fa fa-info"></i> Handle closeIcon's callback