ng-repeat仅迭代第一个项目

时间:2014-01-24 17:09:15

标签: angularjs pug

主文件:

#major(ng-controller='AppCtrl', ng-init="set_riddleTypes(#{JSON.stringify(riddleTypes)}); set_riddleDB(#{JSON.stringify(riddleDB)})")
  #riddlrHead.accordionButton
    .riddlrName Riddlr
    .profile1
      span
        a(href='#') #{user.name}
      p
        a(href='#') #{user.solveCount} riddles, #{user.points} points
    .profile_round
  #mainBody.accordionContent
    #foodOptions
      br
      br
      span What would you like to eat?
      ul
        li(ng-repeat="riddleType in riddleTypes")
          {{riddleType}}

AppCtrl文件:

function AppCtrl($scope){

    $scope.set_riddleTypes = function(riddleTypes){
        $scope.riddleTypes = riddleTypes;
    };

    $scope.set_riddleDB = function(riddleDB){
        $scope.riddleDB = riddleDB;
    }
}

riddletypes列表包含14个项目。如果我只显示riddletypes,它会显示整个列表,但ng-repeat只会迭代第一个项目。知道为什么吗?

0 个答案:

没有答案