0

I have table with ng-repeat values which I fetch from mysql(Codeigniter). and this table has checkbox which I select to create a JSON.

<tr ng-repeat="subject in subject_list | orderBy: 'sub_branch' | filter: search_subject">
                        <td><input type="checkbox" 
ng-true-value="{{subject.sub_id}}" 
ng-model="checkmodel.subject.sub_id"  
ng-true-value="subject.sub_id"
ng-name="subject_name"></td>
<td>{{subject.sub_name}}</td>
<td>{{subject.sub_branch}}</td>
<td>{{subject.sub_code}}</td>
<td>{{subject.sub_sem}}</td>
<td><select ng-model="checkmodel.subject.section" ng-disabled="!checkmodel.subject.sub_id">
                                <option value="A">A</option>
                                <option value="B">B</option>
                                <option value="C">C</option>
                                <option value="D">D</option>
                            </select></td>
                        </tr>

Problem 1: I'm only able to select one checkbox.

Problem 2: When I select a value from dropdown, the same value automatically selected in other dropdown boxes.

Here is sample JSON: {"subject":{"sub_id":1,"section":"A"}}

2
  • What does using two ng-true-value attributes mean? Commented Jan 20, 2017 at 6:15
  • @shukshin.ivan i accidentally added them two times. thanks. Commented Jan 20, 2017 at 6:18

1 Answer 1

1

For both of the problem, I would suggest you inspect the elements to make sure that the ng-model is not same. You have to have different models for every checkbox as well as select menu.

Sign up to request clarification or add additional context in comments.

1 Comment

let me try i will let you know if it worked or not, Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.