-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
196 lines (156 loc) · 5.88 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
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/app.css" />
<script type="text/javascript" src='js/angular.min.js'></script>
<script type="text/javascript" src='js/jquery.min.js'></script>
<script type="text/javascript" src='js/bootstrap.min.js'></script>
<script type="text/javascript" src='app.js'></script>
</head>
<body ng-app='myApp' ng-controller='AppController'>
<div class="container jumbotron text-center" >
<div>
<h2>Angular Crud</h2>
<p>Create, Read ,Update, Delete</p>
</div>
</div> <!-- close container -->
<div class="container">
<hr>
<button type="button" class="btn btn-primary btn-lg pull-right" data-toggle="modal" data-target="#loginModal">New User</button>
<h2>All Users</h2>
<span class='clearfix'></span>
<hr>
<div class="alert alert-success" ng-if='message'>
<a href="#" class="close" aria-label="close" ng-click='clearMessage()'>×</a>
<strong>{{ message }}</strong>
</div>
<table class="table table-hover" >
<thead>
<tr>
<th>Index</th>
<th>Name</th>
<th>Username</th>
<th>Email</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody >
<tr ng-repeat = 'user in users'>
<td>{{ $index + 1 }}</td>
<td>{{ user.name }}</td>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td><button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#editModal" ng-click='selectUser(user)'>Edit</button></td>
<td><button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#deleteModal" ng-click='selectUser(user)' >Delete</button></td>
</tr>
</tbody>
</table>
<!-- Modal -->
<div id="loginModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Create New User</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="name">Name:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" placeholder="Enter Name" ng-model='newUser.name'>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Username:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="pwd" placeholder="Enter Username" ng-model='newUser.username'>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Enter email" ng-model='newUser.email'>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default" data-dismiss="modal" ng-click='saveUser()'>Save</button>
</div>
</div>
</form>
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div> -->
</div>
</div>
</div>
<!-- modal! end-->
<div id="editModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Edit User</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="control-label col-sm-2" for="name">Name:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" placeholder="Enter Name" ng-model='clickedUser.name'>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Username:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="pwd" placeholder="Enter Username" ng-model='clickedUser.username'>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Enter email" ng-model='clickedUser.email'>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default" data-dismiss="modal" ng-click='updateUser()'>Update</button>
</div>
</div>
</form>
</div>
<!-- <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div> -->
</div>
</div>
</div>
<!-- Modal -->
<div id="deleteModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Delete User</h4>
</div>
<div class="modal-body">
<p>Are you sure you want to delete <strong> {{ clickedUser.name }}</strong> ?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" ng-click='deleteUser()'>Yes</button>
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>