Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

Updating using AngularJS

Ads

 
 

Share on Google+Share on Google+

Gurpreet Singh
Updating using AngularJS
0 Answer(s)      4 years and 3 months ago
Posted in : JavaScript Questions

Shopping.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></meta>
    <title>Shopping</title>
  </head>
  <body>
   <h1>Two Way Data Binding Example</h1><br>
      <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular-resource.min.js">
    </script>
      <script src="Shopping.js"></script>
  <div ng-app>
        <div ng-controller="ShoppingCartCtrl">
            <br />
            <table border="1">
                <thead>
                    <tr>
                        <td>Name</td>
                        <td>Price</td>
                        <td>Quantity</td>
                        <td>Remove Item</td>
                    </tr>
                </thead>
                <tbody ng-repeat="item in items">
                    <tr>
                        <td>{{item.Name}}</td>
                        <td>{{item.Price}}</td>
                        <td>{{item.Quantity}}</td>
                        <td><input type="button" value="Remove" ng-click="removeItem($index)" /></td>
                    </tr>
                </tbody>
            </table>
            <br />
            <div>Total Price: {{totalPrice()}}</div>
            <br />
            <table>
                <tr>
                    <td>Name: </td>
                    <td><input type="text" ng-model="item.Name" /></td>
                </tr>
                <tr>
                    <td>Price: </td>
                    <td><input type="text" ng-model="item.Price" /></td>
                </tr>
                <tr>
                    <td>Quantity: </td>
                    <td><input type="text" ng-model="item.Quantity" /></td>
                </tr>
                <tr>
                    <td colspan="2"><input type="Button" value="Add" ng-click="addItem(item)" /> </td>

                </tr>
            </table>
        </div>
    </div>
        </body>
</html>

Shopping.js

function ShoppingCartCtrl($scope)  {
        $scope.items = [
            {Name: "Soap", Price: "25", Quantity: "10"},
            {Name: "Shaving cream", Price: "50", Quantity: "15"},
            {Name: "Shampoo", Price: "100", Quantity: "5"}
        ];

        $scope.addItem = function(item) {
            $scope.items.push(item);
            $scope.item = {};
        }

        $scope.totalPrice = function(){
            var total = 0;
            for(count=0;count<$scope.items.length;count++){
                total += $scope.items[count].Price*$scope.items[count].Quantity;
            }
            return total;
        }

        $scope.removeItem = function(index){
            $scope.items.splice(index,1);
        }
    }

This is the demo example code for adding data and deleting data using angularJS. I want to add one more button for updating items in the table for Updating Items in Shopping.html. On clicking updating button for each row ( as like Remove button in each row) I want the items in table (for that row for which we clicked Update button) comes in edit mode and Update button changes to Save button for that particular row. I want to do all this functionality using AngularJS and updation also with Two way binding (As in angularJS). Please help me to do the given functinality using full feautres of AngularJS. I searched many examples but unable to find so. Thanks and Regards, Gurpreet Singh

Ads
View Answers
Ads









Related Tutorials/Questions & Answers:
Updating using AngularJS
Updating using AngularJS  Shopping.html <!DOCTYPE HTML PUBLIC...); } } This is the demo example code for adding data and deleting data using angularJS. I want to add... row. I want to do all this functionality using AngularJS and updation also
What are prerequisite for learning angularjs?
What are prerequisite for learning angularjs?  Hi, I have to learn angularjs for next project. What are prerequisite for learning angularjs? Thanks   Hi, What are the prerequisites for learning angularjs? Reply fast
Advertisements
Download and Install AngularJS
we have defined a controller in AngularJS using following code: <div ng...Download and Install AngularJS in a project As mentioned earlier Download and Install AngularJS is a JavaScript library which is used in a web application
Updating Ms Access Database using jsp - JSP-Servlet
Updating Ms Access Database using jsp  Hi I am new to jsp and I am trying to update a record in an access database. I only want to update part of the record because the other columns already have data. When I use Update
AngularJS Tutorials
AngularJS frontend framework Tutorials In this section we are going to provide you easy to learn and try tutorials of popular AngularJS framework which... are experienced web developer then you can learn AngularJS in just 2-4 days
coding for updating profile
coding for updating profile  coding for updating profile
Updating log4j programatically
Updating log4j programatically  Is there a ready made utility which I can use to edit the log4j.xml programmatically
updating & deleting an employee
updating & deleting an employee  can anyone help out me please? advance thanks warm regards
Updating multiple value depending on checkboxes
Updating multiple value depending on checkboxes  Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes..? please answer if any one knows as soon as possible
updating a table in a database - SQL
updating a table in a database  give me complete source code in java to execute the sqlquery such that (update table_name set phone no=? where cous_id=?). or in simple way give me source code to update my table in MsAccess
Updating user profile
Updating user profile  how should i provide user to update his profile with edit option including entered data by user should be shown in jsp page fileds   The given code retrieve data from database and display
Updating from MySQL 5.0 to 5.5 cPanel
Updating from MySQL 5.0 to 5.5 cPanel   Updating from MySQL 5.0 to 5.5 cPanel
Problem in updating query in Hibernate - Hibernate
Problem in updating query in Hibernate  Hi, I have used a query to update the existing columns of one table. The query updates the records in the main table but it does not update the tables that are mapped from the main table
Update Records using Prepared Statement
for updating the records. In this JDBC tutorial we are going to learn about the process of updating the records by using the PreparedStatement.  Here arise... Update Records using Prepared Statement   
Lock while inserting/updating database in multithreaded.
Lock while inserting/updating database in multithreaded.  Hi, I am... inserting/updating to database. I dont know what is the issue but it was never... am using ojdbc5.jar for jdbc connection. Please help me out, its killing me
Starting MySQL.. ERROR! The server quit without updating PID file
Starting MySQL.. ERROR! The server quit without updating PID file  I...: Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib... on disk using following command: fdisk -h and found there is no space
updating an access database with visual basic 2010
updating an access database with visual basic 2010  I am building a program in visual basic 2010 that connects to an access database. I was wondering if you could help me figure out the code for the save button. When
how to code-updating some details n some details r unchanged
how to code-updating some details n some details r unchanged  i have... the update query,but with that query all the details are updating... my doubt... are using? Specify it.   jsp,jdbc,sybase   i m using jsp,jdbc
updating column automatically based on system date
updating column automatically based on system date  hi, can any one give solution for my question i have a table called leave balanced(leave-id,leave balance,etc are column),in leave balance column each employee has some leave
what is wrong with my JSP codes for updating a form?
what is wrong with my JSP codes for updating a form?  Hi experts, I have tried to emulate a code from a textbook but it doesn't work in my program. Hope someone can advise me where I had gone wrong. Tks. I've set up my
Starting MySQL.The server quit without updating PID file
Starting MySQL.The server quit without updating PID file  Starting MySQL.The server quit without updating PID file (/var/lib/mysql/xxxxxx.pid
Starting MySQL....The server quit without updating PID file
Starting MySQL....The server quit without updating PID file  Hi, My... error: Starting MySQL....The server quit without updating PID file (/var/lib/mysql/xxxxx.pid). MySQL Restart fails and the server quit without updating PID
Updating variables in a loop? and only printing certain messages after the first iteration?!
Updating variables in a loop? and only printing certain messages after the first iteration?!  I've written a program that reads two values. I then want it to repeatedly read a further two values until someone enters 0
updating rows which contains same id, different value for each row
updating rows which contains same id, different value for each row  Student table: sid name age 3 suresh 24 2 surya
Updating rows who has same id with different values for each row from java program
Updating rows who has same id with different values for each row from java program  Here is my requirement, Following is a table which contains 5 rows with same id. student table: sid sname age 2 aruna 25 2
Identify correct and incorrect statements or examples about the rules and semantics for relationship assignment and relationship updating in a CMP bean.
Identify correct and incorrect statements or examples about the rules and semantics for relationship assignment and relationship updating... for relationship assignment and relationship updating in a CMP bean. The assignment
using array
using array  transpose a matrix
using array
using array  transpose a matrix
using prompt
using prompt  how to use prompt
using array
using array  column wise total of a matrix
using function
using function   using a function to find the value of v from the foiiowing expression 1v=1u+1*f