0

这有什么问题?它输出的列表看起来很奇怪,最后一个元素(正确的一个)与其余元素未对齐。另外我需要运行一个随机化元素的函数,应该去哪里?

<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 看起来像这样

{correct: "작아",
incorrect: ["자가", "작ㅏ", "작"]}
4

1 回答 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: "작"}
]
于 2013-02-21T18:56:14.713 回答