gpt4 book ai didi

javascript - AngularJS ng 样式不起作用

转载 作者:行者123 更新时间:2023-11-29 10:44:38 24 4
gpt4 key购买 nike

我正在尝试使用 AngularJS ng-stylediv 上应用背景色。我的颜色来自数据库。它不适合我。有谁能够帮助我。

<div ng-controller="IndexCtrl">
<div style="width: 500px;">
<table class="table table-striped table-bordered table-condensed table-hover">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Edit</th>
</tr>
</thead>
<tbody ng-repeat="color in colors">
<tr ng-show="edit">
<td><input type="text" ng-model="color.ID" ng-change="color.changed=true" /></td>
<td>
<input type="text" ng-model="color.Name" colorpicker ng-change="color.changed=true" />
</td>
<td><input type="button" class="btn btn-primary" value="Save" ng-click="edit=false; save();" /> </td>
</tr>
<tr ng-hide="edit">
<td><strong>{{color.ID}}</strong> </td>
<td><div style="width:20px; height:20px; border:thin solid black" ng-model="color.Name" ng-style="{'background-color' : color.Name}"></div> </td>
<td><input type="button" class="btn btn-primary" value="Edit" ng-click="edit=true;" /></td>
</tr>
</tbody>
</table>
</div>
</div>

最佳答案

http://plnkr.co/edit/LV96s0szWbBFkzCCKfpJ?p=preview

这更像是您需要的。看一看。

关于javascript - AngularJS ng 样式不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22013818/

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