forked from kensho-technologies/ng-alertify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
92 lines (87 loc) · 2.83 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
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>ng-alertify</title>
<script src="node_modules/es5-shim/es5-shim.js"></script>
<link rel="stylesheet" href="dist/ng-alertify.css" />
<style>
#app {
padding: 5px;
margin: 10px 0px;
display: block;
border: 1px solid black;
border-radius: 5px;
white-space: pre;
font-family: monospace;
}
#app:before {
content: "using ng-alertify";
font-style: italic;
color: #555;
}
.vertical-margin {
margin-top: 200px;
}
</style>
</head>
<body ng-app="App" ng-controller="AppController">
<h2>ng-alertify by <a href="https://www.kensho.com">Kensho</a></h2>
AngularJS wrapper around <a href="http://fabien-d.github.io/alertify.js/">alertify.js</a>.
<button ng-click="alert()">Show alert modal</button>
<button ng-click="ask()">Show confirm dialog</button>
<button ng-click="prompt()">Show prompt dialog</button>
<button ng-click="askWithCssClass()">Show confirm dialog with css class</button>
<button ng-click="json()">Show JSON object</button>
<p>Source at <a href="https://github.com/kensho/ng-alertify">kensho/ng-alertify</a>.</p>
<script src="bower_components/angular/angular.js"></script>
<script src="dist/ng-alertify.js"></script>
<script id="app">
angular.module('App', ['Alertify'])
.run(function (Alertify) {
Alertify.success('Hello world!');
Alertify.log('Neutral message');
Alertify.error('Something went wrong');
})
.controller('AppController', function ($scope, Alertify) {
$scope.alert = function () {
Alertify.alert('This is an alert');
};
$scope.ask = function () {
Alertify.confirm('Are you sure?')
.then(function () {
Alertify.success('You are sure!');
}, function () {
Alertify.log('Never mind');
});
};
$scope.prompt = function () {
Alertify.prompt('How should I address you?', 'My friend')
.then(function (title) {
Alertify.success('Hi there, ' + title);
}, function () {
Alertify.log('Never mind');
});
};
$scope.askWithCssClass = function () {
Alertify.confirm('Are you sure?', 'vertical-margin')
.then(function () {
Alertify.success('You are sure!');
}, function () {
Alertify.log('Never mind');
});
};
$scope.json = function json() {
var largeObject = {
foo: 'this is a foo',
bar: {
name: 'bar inside of foo'
},
list: ['something', 'else', 'nothing']
};
Alertify.json('a large object', largeObject);
};
});
</script>
</body>
</html>