0

I have a set of Radio-bottoms, that is driven off a Array. for a Multi-Choice answer setup.

<div ng-repeat="option in options">
   <div>
      <button type="button" style="min-width: 100px" class="btn btn-default" ng-model="question.answer" btn-radio="'{{option.option_id}}'">{{option.option_text}}</button>
    </div>
</div>

When I add to the array, things are good, mainly since the preset answer is lower than the new element in Options.

If I then delete one of the Options above the answer, and redefined the new Answer id.. the Radio buttons are not updated correctly. I know the answer is updated as I have it displayed on the screen. but the buttons are not updated.

UPDATE NEW PLUNKER! I have done a plunker : http://plnkr.co/edit/2XWFwClewqtcXWPY8ZSK. As you can see if you select the different options the answer follows.. Now if you select the third option and remove the first or second option you will see that the answer will update but the check buttons is not updated right.

Can someone shed some light on this ? Thanks in advance Kim

2
  • I'm suspecting that your problem might be related to $scopes and inheritance. This video might help youtube.com/watch?v=DTx23w4z6Kc Commented Jan 11, 2014 at 18:44
  • Thanks for your fast answer.. I actually are using the . (I wrongly tried to simplify) and all works until I start messing with the options list, meaning deleting elements above the selected answer the update goes wrong. Commented Jan 11, 2014 at 19:02

1 Answer 1

0

With some genouros help from the ui team did I find that it was a simple type casting error.

$scope.cp.options[i].option_id = i + 1;

Should be

$scope.cp.options[i].option_id = "" + (i + 1);

I have updated the plunker if anyone need the full sample. Here

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.