Javascript AngularJS无法使用ng repeat访问控制器数据

Javascript AngularJS无法使用ng repeat访问控制器数据,javascript,angularjs,Javascript,Angularjs,我有一个带有注释的部分,应该使用ng repeat显示,但我无法访问数据 调试后,我仍然无法访问数据,而不需要修改控制器! 我是个新手,所以我很容易犯愚蠢的错误 HTML/JS “严格使用”; angular.module('commentsApp',[]) .controller('DishDetailController',['$scope',函数($scope){ 真空皿={ 名称:'Uthapizza', 图片:“images/uthapizza.png”, 类别:'干线', 标签:'

我有一个带有注释的部分,应该使用ng repeat显示,但我无法访问数据

调试后,我仍然无法访问数据,而不需要修改控制器! 我是个新手,所以我很容易犯愚蠢的错误

HTML/JS

“严格使用”;
angular.module('commentsApp',[])
.controller('DishDetailController',['$scope',函数($scope){
真空皿={
名称:'Uthapizza',
图片:“images/uthapizza.png”,
类别:'干线',
标签:'热',
价格:'4.99',
描述:“一种独特的印度乌萨帕姆(煎饼)和意大利比萨饼组合,顶部有樱桃橄榄、成熟的葡萄藤樱桃西红柿、维达利亚洋葱、甘特辣椒和水牛肉饼。”,
评论:[
{
评级:5,
评论:“想象一下所有的食物,生活在混乱中!”,
作者:“约翰·莱蒙”,
日期:“2012-10-16T17:57:28.556094Z”
},
{
评级:4,
评论:“把任何人送到天堂,我希望我能让我岳母吃!”,
作者:“Paul McVites”,
日期:“2014-09-05T17:57:28.556094Z”
},
{
评级:3,
评论:“吃吧,就吃吧!”,
作者:“迈克尔·贾基尚”,
日期:“2015-02-13T17:57:28.556094Z”
},
{
评级:4,
评论:“终极,追求星空!”,
作者:“林戈·斯塔里”,
日期:“2013-12-02T17:57:28.556094Z”
},
{
评级:2,
评论:“今天是你的生日,我们要开派对!”,
作者:“25分”,
日期:“2011-12-02T17:57:28.556094Z”
}
]
};
$scope.dish=dish;
}]);

{{entry.comments.rating}}

{{entry.comments.comment}

{{entry.comments.author},{{entry.comments.date}
您的错误是
条目
对象表示
dish.comments
数组中的一个对象,因此要访问数据,只需删除
comments
部分即可

<div ng-app="commentsApp">
  <div ng-controller="DishDetailController">
    <div class="col-xs-9 col-xs-offset-1">
      <div class="blockquote" ng-repeat="entry in dish.comments">
        <blockquote>
          <p>{{entry.rating}} Stars</p>
          <p>{{entry.comment}}</p>
          <footer>{{entry.author}}, {{entry.date | date}}</footer>
        </blockquote>
      </div>
    </div>
  </div>
</div>

{{entry.rating}}星星

{{entry.comment}

{{entry.author},{{entry.date | date}
您的错误是
条目
对象表示
dish.comments
数组中的一个对象,因此要访问数据,只需删除
comments
部分即可

<div ng-app="commentsApp">
  <div ng-controller="DishDetailController">
    <div class="col-xs-9 col-xs-offset-1">
      <div class="blockquote" ng-repeat="entry in dish.comments">
        <blockquote>
          <p>{{entry.rating}} Stars</p>
          <p>{{entry.comment}}</p>
          <footer>{{entry.author}}, {{entry.date | date}}</footer>
        </blockquote>
      </div>
    </div>
  </div>
</div>

{{entry.rating}}星星

{{entry.comment}

{{entry.author},{{entry.date | date}
试试这个:

 <div ng-app="commentsApp">
  <div ng-controller="DishDetailController">
    <div class="col-xs-9 col-xs-offset-1">
      <div class="blockquote" ng-repeat="entry in dish.comments">
        <blockquote>
          <p>{{entry.rating}} Stars</p>
          <p>{{entry.comment}}</p>
          <footer>{{entry.author}}, {{entry.date | date}}</footer>
        </blockquote>
      </div>
    </div>
  </div>
</div>

{{entry.rating}}星星

{{entry.comment}

{{entry.author},{{entry.date | date}
试试这个:

 <div ng-app="commentsApp">
  <div ng-controller="DishDetailController">
    <div class="col-xs-9 col-xs-offset-1">
      <div class="blockquote" ng-repeat="entry in dish.comments">
        <blockquote>
          <p>{{entry.rating}} Stars</p>
          <p>{{entry.comment}}</p>
          <footer>{{entry.author}}, {{entry.date | date}}</footer>
        </blockquote>
      </div>
    </div>
  </div>
</div>

{{entry.rating}}星星

{{entry.comment}

{{entry.author},{{entry.date | date}
您需要将代码更改为此

<div ng-app="commentsApp">
<div ng-controller="DishDetailController">
   <div class="col-xs-9 col-xs-offset-1">

    <div class="blockquote" ng-repeat="entry in dish.comments">
      <blockquote>
      {{entry}}
      <p>{{entry.rating}} Stars</p>
      <p>{{entry.comments}}</p>
      <footer>{{entry.author}}, {{entry.date | date}}</footer>
    </blockquote>
  </div>
</div>
</div>

{{entry}}
{{entry.rating}}星星

{{entry.comments}

{{entry.author},{{entry.date | date}
这是普朗克

您需要将代码更改为

<div ng-app="commentsApp">
<div ng-controller="DishDetailController">
   <div class="col-xs-9 col-xs-offset-1">

    <div class="blockquote" ng-repeat="entry in dish.comments">
      <blockquote>
      {{entry}}
      <p>{{entry.rating}} Stars</p>
      <p>{{entry.comments}}</p>
      <footer>{{entry.author}}, {{entry.date | date}}</footer>
    </blockquote>
  </div>
</div>
</div>

{{entry}}
{{entry.rating}}星星

{{entry.comments}

{{entry.author},{{entry.date | date}
这是普朗克