我是 angularjs 的新手。如何获取表格总金额列中的总金额并显示在输入文本框中?我认为这个 plunker 可以解决我的问题,但我现在无法访问它。http://plnkr.co/edit/CHBm8RCqW5RNZWrzAe5r?p=preview
这是我的表样本
<table>
<thead>
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Total Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="payment_queue in data | filter:searchFilter">
<td>{{payment_queue.product_name}}</td>
<td>{{payment_queue.sold_quantity}}</td>
<td>{{payment_queue.amount}}</td>
</tr>
</tbody>
</table>
Total Amount: <input type="text value=""> <--- the total amount value goes here...
Run Code Online (Sandbox Code Playgroud)
js
var myApp = angular.module('myApp', ['ngRoute']);
myApp.controller('productsalesController', ['$scope', '$http', function ($scope, $http) {
$scope.data=[];
$http.get("../php/paymentQueuedata.php")
.success(function(data){
$scope.data = data;
})
.error(function() {
$scope.data = "error in fetching data";
});
}]);
Run Code Online (Sandbox Code Playgroud)
php json
<?php
//database settings
$connect = mysqli_connect("localhost", "root", …Run Code Online (Sandbox Code Playgroud) 什么是正确或正确的方式?我对此感到困惑.有人能说得对吗?
3digit <= 4digit是false
4digit <= 3digit的true
你可以在这里测试一下:JSFiddle
<h2></h2>
<form id="send" action="#" method="POST">
<input type="text" id="x"><br/>
<input type="text" id="y">
<input type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)
$(document).ready(function() {
$('#send').submit(function(){
var x = $('#x').val();
var y = $("#y").val();
if (x <= y) {
$('h2').html("Done.");
} else {
$('h2').html("Sorry,not enough cash.");
}
event.preventDefault();
});
});
Run Code Online (Sandbox Code Playgroud)