Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!DOCTYPE html>
<html lang="en">
<head>
<title>Phone Book</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js"></script>
<script src="crudCtrlAndService.js"></script>
</head>
<body ng-app='phoneBookApp' ng-controller='CrudCtrl'>
<div class="jumbotron text-center">
<h1>Phone Book</h1>
</div>
<div class="container">
<form class="form-inline" ng-submit="addPhoneNumber(addPhoneNumberForm.$valid)" name="addPhoneNumberForm" id="addPhoneNumberForm" style="margin: 20px;">
<div class="text-center">
<div class="form-group">
<label for="nameAdd">Name: </label>
<input type="text" class="form-control" ng-model="createVM.Name" id="nameAdd" placeholder="Enter Name" name="nameAdd" required>
</div>
<div class="form-group">
<label for="phoneNumberAdd">Phone Number:</label>
<input type="text" class="form-control" ng-model="createVM.Phone_Number" id="phoneNumberAdd" placeholder="Enter Phone Number" name="phoneNumberAdd" required>
</div>
<button ng-click="submit()" class="btn btn-default">Add</button>
</div>
</form>
<div style="height:70px;">
<div ng-if="showAlert" class="alert alert-success">
<strong>{{alertName}}</strong> {{alertMessage}}
</div>
</div>
<table ng-if="phoneBookData.length" class="table table-striped table-bordered">
<thead>
<tr>
<th class="col-sm-1">Sr #</th>
<th class="col-sm-5">Name</th>
<th class="col-sm-5">Phone Number</th>
<th class="col-sm-1">Action</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="data in phoneBookData">
<td>{{$index + 1 }}</td>
<td>{{data.Name}}</td>
<td>{{data.Phone_Number}}</td>
<td>
<span ng-click="openUpdatePhoneNumberModal(data.Id)" data-toggle="modal" data-target="#updateModal" class="glyphicon glyphicon-pencil"></span>
<span ng-click="openDeletePhoneNumberModal(data.Id)" data-toggle="modal" data-target="#deleteModal" class="glyphicon glyphicon-trash"></span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Update Modal -->
<div class="modal fade" id="updateModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Update</h4>
</div>
<form class="form-inline" style="margin: 20px;">
<div class="text-center">
<div class="form-group">
<label for="nameUpdate">Name:</label>
<input type="text" ng-model="updateVM.Name" class="form-control" id="nameUpdate" placeholder="Enter Name" name="nameUpdate" required>
</div>
<div class="form-group">
<label for="phoneNumberUpdate">Phone Number:</label>
<input type="text" ng-model="updateVM.Phone_Number" class="form-control" id="phoneNumberUpdate" placeholder="Enter Phone Number" name="phoneNumberUpdate" required>
</div>
</div>
</form>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" ng-click="updatePhoneNumber(updateVM.Id)" class="btn btn-default" data-dismiss="modal">Update</button>
</div>
</div>
</div>
</div>
<!-- Delete Confirmation Modal -->
<div class="modal fade" id="deleteModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Delete</h4>
</div>
<div class="container" style="margin:10px; ">
<p>Are You Sure You Want To Delete This Record?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button ng-click="deletePhoneNumber(recordIdToDelete)" class="btn btn-default" data-dismiss="modal">Delete</button>
</div>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.