这是我的代码: JS:
$scope.gamma = {
0 : 2
};
$scope.matrix = {
1 : 21, 2 : 25, 3 : 21, 4 : 85, 5 : 798, 6 : 4, 7 : 51, 8 : 224, 9 : 63
};
$scope.update_layers = function(gamma, gvalue, matrix, mvalue){
$scope.gamma = gamma;
if(gvalue){
$scope.gamma.gvalue = parseInt(gvalue)
for(var i in $scope.gamma){
$scope.gamma[i] = parseInt($scope.gamma[i]);
}
}
if(mvalue){
$scope.matrix.mvalue = parseInt(mvalue)
}
HTML:
{{gamma}}{{matrix}}
<br />
gamma : <span ng-repeat="(g, value) in gamma"> <input class="form-control" style="margin:5px;width:100px;text-align:center;display:inline-block;text-align:center" ng-model="gamma[g]"></span>
<br />
matrix : <span ng-repeat="(m, value) in matrix"> <input class="form-control" style="margin:5px;width:100px;text-align:center;display:inline-block;text-align:center" ng-model="matrix[m]"></span>
<button class="btn" ng-click="update_layers(gamma, gamma.value, matrix, matrix.value)">update</button>
我想展示:
"1":21
而非"1":"21"
这是我的plnkr和我的演员:
http://plnkr.co/edit/LFvqgeCtOWv4OGxiDDuY?p=preview
答案 0 :(得分:1)
将[
{
"Product.ProductName":"Test Prod",
"Category.CategoryName":"Condiments!!!",
"Supplier.CompanyName":"Exotic Liquids"
}
]
添加到您的输入字段。例如
type="number"