0

I'm trying to get a list of questions (retrieved dynamically so we can't hard code them) and then using ng-repeat list them out with a three state checkbox next to each (true, false, null).

The code below works to show the questions with the correct checkboxes, however each time you click on 1 checkbox they all change as they are using the same ng-model (I assume).

How do I get around this?

Thanks

<div class="select-all-checkboxes" flex="100" ng-repeat="(guidCustomerId,item) in items" ng-if="item.type=='Mandatory'">
    <span three-state-checkbox ng-model="idv.checkboxModelThree" ng-change="idv.checkBoxonChange()" ng-checked="exists(item, selected_mandatory)"></span>
    <h8-red>{{item.question}}</h8-red>{{item.answer}}
    <br /><br />
</div>
2
  • Did you tried something like ng-model="item.value" ng-change="item.value = ! item.value"? Commented Oct 20, 2016 at 9:09
  • ng-change="item.value = item.value" did the job :) Commented Oct 20, 2016 at 14:03

1 Answer 1

0

Can you try?

<div class="select-all-checkboxes" flex="100" ng-repeat="(guidCustomerId,item) in items" ng-if="item.type=='Mandatory'">
    <span three-state-checkbox ng-model="item.value" ng-change="item.value = !item.value" ng-checked="exists(item, selected_mandatory)"></span>
    <h8-red>{{item.question}}</h8-red>{{item.answer}}
    <br /><br />
</div>
Sign up to request clarification or add additional context in comments.

Comments

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.