ng-repeat列表中的ui-select如何动态设置当前值 10
<tableclass="tabletable-borderedtable-striped"><thead><tr><th>序号</th><th>名称</th><th>状...
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>序号</th>
<th>名称</th>
<th>状态</th>
<th>备注</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in data">
<td>{{$index+1}}</td>
<td>
<ui-select ng-model="user.selected" theme="bootstrap">
<ui-select-match placeholder="Select or search a user in the list...">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="user in users | filter: $select.search">
<div ng-bind-html="user.name | highlight: $select.search"></div>
<small ng-bind-html="user.desc | highlight: $select.search"></small>
</ui-select-choices>
</ui-select>
</td>
<td>
<select class="form-control m-t" ng-model="item.status" >
<option value="0">正常</option>
<option value="1">停用</option>
</select>
</td>
<td>
<input class="form-control" type="text" ng-model="item.desc">
</td>
<td style="white-space: nowrap">
<div class="buttons">
<button class="btn btn-sm btn-danger" ng-click="del(x.id)">删除</button>
</div>
</td>
</tr>
</tbody>
</table> 展开
<thead>
<tr>
<th>序号</th>
<th>名称</th>
<th>状态</th>
<th>备注</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in data">
<td>{{$index+1}}</td>
<td>
<ui-select ng-model="user.selected" theme="bootstrap">
<ui-select-match placeholder="Select or search a user in the list...">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="user in users | filter: $select.search">
<div ng-bind-html="user.name | highlight: $select.search"></div>
<small ng-bind-html="user.desc | highlight: $select.search"></small>
</ui-select-choices>
</ui-select>
</td>
<td>
<select class="form-control m-t" ng-model="item.status" >
<option value="0">正常</option>
<option value="1">停用</option>
</select>
</td>
<td>
<input class="form-control" type="text" ng-model="item.desc">
</td>
<td style="white-space: nowrap">
<div class="buttons">
<button class="btn btn-sm btn-danger" ng-click="del(x.id)">删除</button>
</div>
</td>
</tr>
</tbody>
</table> 展开
1个回答
展开全部
form1.aa.innerHTML = "<option>***</option><option>***</option>***<option>***</option>";
就可以了,这里form1是form标签的name属性值。
等好右边的东东可以是字符串变量,因此具体加多少个,怎么加,呵呵,楼主应该知道了吧?
IE下面可以。其他浏览器从没试过。
<form name='fm1'>
<select name='aa'><option>1</option></select>
</form>
<input type='button' value='ADD' onclick='javascript:Add()'>
<script language='javascript'>
i = 1;
function Add()
{
i++;
fm1.aa.length = i;
fm1.aa.options[i - 1].text = i;
}
</script>
就可以了,这里form1是form标签的name属性值。
等好右边的东东可以是字符串变量,因此具体加多少个,怎么加,呵呵,楼主应该知道了吧?
IE下面可以。其他浏览器从没试过。
<form name='fm1'>
<select name='aa'><option>1</option></select>
</form>
<input type='button' value='ADD' onclick='javascript:Add()'>
<script language='javascript'>
i = 1;
function Add()
{
i++;
fm1.aa.length = i;
fm1.aa.options[i - 1].text = i;
}
</script>
追问
@藤原子大雄 谢谢,这个是js的写法,我用的是angularjs ui-select模块
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询