AngularJS中获取ng-repeat动态生成的ng-model值
发布时间:2020-12-17 10:09:24 所属栏目:安全 来源:网络整理
导读:请关注我的微信公众号 angularJS动态设置model,并设置/获取model的值 代码 html div div class = "modal-header" h3 class = "modal-title" 用例集全局参数配置 / h3 / div div class = "modal-body" table class = "table table-hover" thead tr th 参数 /
请关注我的微信公众号
代码html<div>
<div class="modal-header">
<h3 class="modal-title">用例集全局参数配置</h3>
</div>
<div class="modal-body">
<table class="table table-hover">
<thead>
<tr>
<th>参数</th>
<th>参数值</th>
</tr>
</thead>
<tbody ng-repeat="param in params">
<tr>
<td>{{param}}</td>
<td><input name="test" class="form-control" type="text" ng-trim="false" ng-model="$parent.conf[$index]"/></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">
应用
</button>
<button class="btn btn-warning" ng-click="cancel()">取消</button>
</div>
</div>
JSvar ModalInstanceCtrl = function ($scope,$modalInstance,params) {
$scope.params = params;
$scope.conf = [];
$scope.ok = function () {
console.log($scope.conf);
$modalInstance.close($scope.conf);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};
问题描述因为 解决方法首先
我们在 实际效果(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |