gpt4 book ai didi

javascript - 带 Angular ngrepeat 的切换按钮

转载 作者:行者123 更新时间:2023-11-28 06:08:00 24 4
gpt4 key购买 nike

我想制作一个 Bootstrap 的切换按钮,但我遇到了一些问题。切换按钮不是 View ,仅显示复选框,当我删除 ngRepeat 指令时,它仅适用于单个按钮,但我需要使用 ngRepeat 来使用多个按钮。所以请帮助我。

<div class="box-body" ng-controller="AutomationController">
<div class="table-responsive">
<table class="table table-hover ">
<thead>
<tr>
<th>Device Name</th>
<th>Status</th>
<th>Action</th>
<th>Edit Device Name</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="device in devices">
<td>[[device.dname]]</td>
<td>
<span ng-if="device.status===1">ON</span>
<span ng-if="device.status===0">OFF</span>
</td>
<td>
<input type="checkbox" checked data-toggle="toggle" ng-if="device.status===1">
<input type="checkbox" checked data-toggle="toggle" ng-if="device.status===0">
</td>
<td><a href="#"><i class="fa fa-pencil-square-o"></i></a></td>
</tr>
</tbody>
</table>
</div>
</div>

最佳答案

检查jsfiddel

you should use radio button for toggle and bind that to status column.

关于javascript - 带 Angular ngrepeat 的切换按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36654760/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com