Permalink
Browse files

Fixed default button of form submit

  • Loading branch information...
1 parent 6f47850 commit c2960dba7e4afddd53270d8f68167f8e30b3beb3 @itswadesh committed Sep 6, 2015
Showing with 28 additions and 19 deletions.
  1. +17 −2 README.md
  2. +11 −12 public/index.html
  3. +0 −5 routes/api.js
View
@@ -1,13 +1,28 @@
## Creating ReSTful API using NodeJS and consuming in AngularJS
-Create ReST API using NodeJS, MongoDB and consuming in a application created uisng AngularJS
+Create simple ReST API using NodeJS, MongoDB and consuming in a application created with AngularJS
#### Requirements
Install the following 2 softwares
* Node http://nodejs.org/
* MongoDB https://www.mongodb.org/
#### Install
-To start the application, run the following 2 commands
+To start the application, run the following 2 commands in your terminal (command prompt).
+Prefix sudo if working in linux machine
+
+Start mongodb
+-----------------------
+Windows
+browse into your mongodb installation folder and into the bin directory
+Run mongod.exe
+
+C:\Program Files\MongoDB 2.6 Standard\bin\mongod.exe
+
+linux
+./mongod
+
* npm install
* node server
+
+Open your browser and point to http://localhost:3000
View
@@ -8,7 +8,7 @@
</head>
<body>
<div class="container" ng-controller="ProductsCtrl">
-
+ <form name="Codenx" novalidate>
<table class="table">
<thead>
<tr>
@@ -21,17 +21,15 @@
</thead>
<tbody>
<tr>
- <form>
- <td><input class="form-control" ng-model="product.name"></td>
- <td><input class="form-control" ng-model="product.sku"></td>
- <td><input class="form-control" ng-model="product.price"></td>
- <td><button class="btn btn-primary" ng-click="add(product)" ng-if="!product._id" type="submit">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>
- </form>
+ <td><input class="form-control" ng-model="product.name" required="" type="text"></td>
+ <td><input class="form-control" ng-model="product.sku" type="text"></td>
+ <td><input class="form-control" ng-model="product.price" type="text"></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>
@@ -46,6 +44,7 @@
</tr>
</tbody>
</table>
+ </form>
</div>
View
@@ -8,10 +8,5 @@ var Product = require('../models/product');
Product.methods(['get', 'put', 'post', 'delete']);
Product.register(router, '/products');
-//Category
-/*var Category = require('../models/category');
-Category.methods(['get', 'put', 'post', 'delete']);
-Category.register(router, '/category');
-*/
// Return router
module.exports = router;

0 comments on commit c2960db

Please sign in to comment.