我们可以为type =“checkbox”设置复选框图片与ng重复使用angularjs [英] Can we set checkbox image for type="checkbox" with ng-repeat using angularjs

查看:175
本文介绍了我们可以为type =“checkbox”设置复选框图片与ng重复使用angularjs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我试图设置复选框图像输入类型=复选框与ng重复。我做了样式部分一切都很好,但当我设置ng-repeat它只工作的第一个列表
这里是我的css文件

Hey I am trying to set check-box image for input type="checkbox" with ng-repeat. I did the styling part everything is fine but when i set ng-repeat it is working for only first list here it is my css file

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;
}

基本上试试这个示例,但它也不能用于ng-repeat和im从数据库检索值。任何一个人可以帮助我在这我受到这个问题。图片为

basically im trying with this example but it is also not working for ng-repeat and im retrieving the values from database. Can any one one help me in this I am struck with this issue. Images are

推荐答案

我猜想问题在于你的id值...它必须是唯一的。因此,id =radiobutton1应为id =radibutton {{$ index}}。但是发布你的htmlcode和病情给一个更好的答案。

Can you post your htmlcode? I would guess the problem is lying in your id value... It has to be unique. So i.e. id="radiobutton1" should be id="radibutton{{$index}}". But post your htmlcode and ill give a better answer.

这篇关于我们可以为type =“checkbox”设置复选框图片与ng重复使用angularjs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆