【问题标题】:Can we set checkbox image for type="checkbox" with ng-repeat using angularjs我们可以使用 angularjs 使用 ng-repeat 为 type="checkbox" 设置复选框图像吗
【发布时间】:2014-03-18 23:46:52
【问题描述】:

嘿,我正在尝试使用 ng-repeat 为 input type="checkbox" 设置复选框图像。我做了造型部分一切都很好但是当我设置 ng-repeat 它只适用于第一个列表 这是我的css文件

input[type=checkbox] {
    display:none;
}

  input[type=checkbox] + label {
  padding-left: 23px; height:21px;
background: url(/Content/images/check1-off.png) no-repeat;
font-family: Arial, Helvetica, sans-serif;
font-size:16px; font-weight:600;
color:#ffffff;
text-decoration:none;
margin-bottom: 0px;
display: inline;
}

  input[type=checkbox]:checked + label{
     padding-left: 23px; height:21px;
background: url(/Content/images/check1-on.png) no-repeat;
font-family: Arial, Helvetica, sans-serif;
font-size:16px; font-weight:600;
color:#ffffff;
text-decoration:none;
  margin-bottom: 0px;   
   display: inline;
}

基本上我正在尝试使用这个example,但它也不适用于 ng-repeat 并且我正在从数据库中检索值。任何人都可以帮助我吗?我对这个问题感到震惊。图片是

【问题讨论】:

  • 如果您可以发布可能存在问题的 js 代码将会很有帮助
  • 我没有在 js 代码中编写任何内容,如果我没有将任何类应用于复选框标签,则该值正在检索

标签: css angularjs checkbox


【解决方案1】:

你能发布你的htmlcode吗?我猜问题在于您的 id 值......它必须是唯一的。所以 id="radiobutton1" 应该是 id="radibutton{{$index}}"。但是发布您的 htmlcode 并给出更好的答案。

【讨论】:

    猜你喜欢
    • 2016-11-11
    • 2016-07-26
    • 1970-01-01
    • 2013-10-09
    • 1970-01-01
    • 2014-03-08
    • 1970-01-01
    • 2015-08-29
    • 1970-01-01
    相关资源
    最近更新 更多