0

这就是我想要做的:

<div class="row-fluid" ng-repeat="subtopic in topic.Subtopics">
  <div class="row_divider"></div>
  <div class="row_padding">
    <span class="subtopic_level">{{subtopic.Name}}</span>
  </div>
  <div class="row-fluid" ng-repeat="subsubtopic in subtopic.Subsubtopics">
    <div class="row_divider" ng-hide="subsubtopic.Name = subtopic.Name"></div>
    <div class="row_padding" ng-hide="subsubtopic.Name = subtopic.Name">
      <span class="subsubtopic_level">{{subsubtopic.Name}}</span>
    </div>
    <div ng-class="row-fluid: true, flat: flatTopicBranch(subsubtopic.Name=subtopic.Name)" ng-repeat="lesson in subsubtopic.Lessons">
      <div class="row_divider"></div>
      <div class="row_padding">
        <span class="lesson_level">{{lesson.Name}}</span>
      </div>
    </div>
  </div>
</div>

这是我的控制器中的功能:

controllers.controller('YourSigmaCtrl', function ($scope, $http) {
...
  $scope.flatTopicBranch = function (subsubtopic, subtopic) {
    return subsubtopic === subtopic;
  };
...

它在 html 中显示不变。不受影响。未受影响。有任何想法吗??flatTopicBranch 是一个问题,因为我在调用它时更深入地了解它吗?

谢谢!

4

1 回答 1

1
<div ng-class="row-fluid: true,
flat: flatTopicBranch(subsubtopic.Name=subtopic.Name)"
ng-repeat="lesson in subsubtopic.Lessons">

这是包含对flatTopicBranc()函数的调用的代码。该函数接受两个参数。如您所见,当您调用此函数时,您似乎只传递了一个参数:flat: flatTopicBranch(subsubtopic.Name=subtopic.Name). 您是否要传递两个参数?

换句话说,也许您需要将调用更改为flat: flatTopicBranch(subsubtopic.Name, subtopic.Name)- 传递两个参数而不是一个(您使用的是相等运算符,我怀疑您想传递两个用逗号分隔的参数而不是一个运算符。

于 2013-06-07T03:31:29.970 回答