Skip to content

Instantly share code, notes, and snippets.

@itswadesh
Last active March 27, 2017 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itswadesh/3d4eb6a6cb1ff6be00d7604236ae69cc to your computer and use it in GitHub Desktop.
Save itswadesh/3d4eb6a6cb1ff6be00d7604236ae69cc to your computer and use it in GitHub Desktop.
<!DOCTYPE>
<html ng-app="myApp">
<head>
<title>Simple demonstration of AngularJS with ReSTful API - AngularCode</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/ngProgress.css">
<link rel="stylesheet" href="css/toaster.css">
<style>
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}
</style>
</head>
<body ng-cloak>
<div class="container" ng-controller="ProductsCtrl">
<form name="Codenx" novalidate>
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>SKU</th>
<th>Price</th>
<th>Action</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td><input class="form-control" ng-model="product.name" required="" placeholder="Product Name"></td>
<td><input class="form-control" ng-model="product.sku" placeholder="Stock Control Unit"></td>
<td><input class="form-control" ng-model="product.price" placeholder="Should be a number"></td>
<td><button class="btn btn-primary" ng-click="add(product)" ng-if="!product._id" type="submit" ng-disabled="!Codenx.$valid">Add Product</button>
<div class="btn-group">
<button class="btn btn-info" ng-click="update(product)" ng-if="product._id" type="submit">Update</button>
<button class="btn" ng-click="deselect()" ng-if="product._id">Clear</button>
</div>
</td>
</tr>
<tr ng-repeat="product in products">
<td>{{product.name}}</td>
<td>{{product.sku}}</td>
<td>{{product.price}}</td>
<td>
<div class="btn-group">
<button class="btn btn-danger" ng-click="remove(product)">Remove</button>
<button class="btn btn-warning" ng-click="edit(product._id)">Edit</button>
</div>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div data-loading></div>
<toaster-container toaster-options="{'time-out': 3000, 'close-button':true, 'animation-class': 'toast-top-center'}"></toaster-container>
<script src="js/angular.min.js"></script>
<script src="js/angular-resource.min.js"></script>
<script src="js/angular-animate.min.js"></script>
<script src="js/ngProgress.min.js"></script>
<script src="js/toaster.js"></script>
<script src="app/app.js"></script>
<script src="app/products.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment