Reputation: 4915
What is wrong with this? The list that it outputs looks all weird, the last element (correct one) gets misaligned from the rest. Also I need to run a function that randomizes the elements, where should that go?
<div ng-controller="getAnswers" id="pannel">
<div id="base"></div>
<ul class="answers">
<li ng-repeat="wrong in answers.incorrect" class="answer" id="wrong{{$index}}">{{wrong}}</li>
<li class="answer ng-scope" id="correct">{{answers.correct}}</li>
</ul>
</div>
$scope.answers looks like this
{correct: "작아",
incorrect: ["자가", "작ㅏ", "작"]}
Upvotes: 0
Views: 219
Reputation: 4915
I resolved the issue by changing the data to this format and looping through it that way. Makes more sense to build the UL in one pass anyway.
[
{correct: "correct", text: "작아"},
{correct: "incorrect", text: "자가"},
{correct: "incorrect", text: "작ㅏ"},
{correct: "incorrect", text: "작"}
]
Upvotes: 0