angular.js - Angular ng-repeat子級迴圈
黄舟
黄舟 2017-05-15 17:02:04
0
1
626

我想循環顯示評論結果,但一直無法顯示。

  <ul>
  <li ng-repeat="dish in menuCtrl.dishes.comments ">
   <li ng-repeat="comments in dish.comments ">
   <p> {{comments.comment}}</p>
      </li>     
  </li>
</ul>

程式碼如下:

js:

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全部回覆(1)
我想大声告诉你

menuCtrl是什麼?把它刪掉試試?

<li ng-repeat="dish in dishes.comments ">

還有,

var app = angular.module('confusionApp', []);
    // 这里你要注入$scope实例:
    app.controller('dishDetailController', function ($scope) {
        // 把dishes放进$scope的属性里
        $scope.dishes = [
            ......
        ]
        // 这句就不用了
        // this.dishes = dishes;
     })
     
// 在html里面,把menuCtrl删掉:
<li ng-repeat="dish in dishes ">
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板