Cathy
Cathy

Reputation: 377

Can we set checkbox image for type="checkbox" with ng-repeat using angularjs

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

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 enter image description here enter image description here

Upvotes: 0

Views: 594

Answers (1)

Erex
Erex

Reputation: 1673

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.

Upvotes: 1

Related Questions