0

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: ["자가", "작ㅏ", "작"]}
2
  • The ng-controller name is a little weird, can you also post the controller definition with what exactly is set in the controller scope? Also you manually add ng-scope? Commented Feb 21, 2013 at 18:39
  • sorry, I actually worked this one out myself by putting everything into an array and setting a correct/incorrect property Commented Feb 21, 2013 at 18:51

1 Answer 1

0

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: "작"}
]
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.