AngularJS ng重复不显示任何值

AngularJS ng重复不显示任何值,angularjs,angularjs-ng-repeat,Angularjs,Angularjs Ng Repeat,我想重复一下这个json(条目): 这是我获取数据的方式: public function index() { $this->Entry->recursive = 0; $this->set('entries', $this->Paginator->paginate()); $this->set('_serialize', 'entries'); } 这是我的显示代码: <table class="table">

我想重复一下这个json(条目):

这是我获取数据的方式:

public function index() {
    $this->Entry->recursive = 0;
    $this->set('entries', $this->Paginator->paginate());
    $this->set('_serialize', 'entries');
}
这是我的显示代码:

<table class="table">
    <thead>
    <tr>
        <th>Title</th>
        <th>Person</th>
        <th>Description</th>
        <th>Finished Date</th>
    </tr>
    </thead>
    <tbody>
    <tr ng-repeat="entry in entries">
        <td>{{ entry.title }}</td>
        <td>{{ entry.person }}</td>
        <td>{{ entry.description }}</td>
        <td>{{ entry.date_finished }}</td>
    </tr>
    </tbody>
</table>

标题
人
描述
完成日期
{{entry.title}
{{entry.person}
{{entry.description}
{{entry.date_finished}
但是没有输出,所有的值都是空的


json格式可以吗?任何建议都会非常有用。

数组中的每个对象都包含一个包含数据的
条目
对象

因此,您可能需要更改以下代码:

<tr ng-repeat="entry in entries">
    <td>{{ entry.Entry.title }}</td>
    <td>{{ entry.Entry.person }}</td>
    <td>{{ entry.Entry.description }}</td>
    <td>{{ entry.Entry.date_finished }}</td>
</tr>

{{entry.entry.title}
{{entry.entry.person}
{{entry.entry.description}
{{entry.entry.date_finished}


顺便说一句,重构JSON对象可能是一种更干净的方法,它可以避免每次都复制
.Entry

应该是
Entry.Entry.title
而不是
Entry.title
。如果不返回任何其他键,则可以删除
输入

    angular.module("myApp",[])
    .controller("myController", ['$scope', function($scope){
          $scope.entries = JSON.parse(JSON.stringify({
      "Entry": [{"Entry": {
        "id": "1",
        "title": "Test",
        "person": "Test",
        "description": "Test",
        "created": "2017-07-11 20:19:55",
        "modified": "2017-07-11 20:19:55",
        "date_finished": "2017-07-11 20:19:00",
        "finished": false
      }},{ "Entry":  {
        "id": "2",
        "title": "Test 1",
        "person": "Test 1",
        "description": "Test 1",
        "created": "2017-07-11 20:23:02",
        "modified": "2017-07-11 20:23:02",
        "date_finished": "2017-07-11 20:22:00",
        "finished": false
      }},{"Entry":   {
        "id": "3",
        "title": "Test 2",
        "person": "Test 2",
        "description": "Test 2",
        "created": "2017-07-11 20:23:13",
        "modified": "2017-07-11 20:23:13",
        "date_finished": "2017-07-11 20:23:00",
        "finished": false
      }}]
    }));
    }])

标题
人
描述
完成日期
{{entry.entry.title}
{{entry.entry.person}
{{entry.entry.description}
{{entry.entry.date_finished}

请避免只回答代码问题。相反,解释你的代码是做什么的,以及它如何/为什么可以解决这个问题。
    angular.module("myApp",[])
    .controller("myController", ['$scope', function($scope){
          $scope.entries = JSON.parse(JSON.stringify({
      "Entry": [{"Entry": {
        "id": "1",
        "title": "Test",
        "person": "Test",
        "description": "Test",
        "created": "2017-07-11 20:19:55",
        "modified": "2017-07-11 20:19:55",
        "date_finished": "2017-07-11 20:19:00",
        "finished": false
      }},{ "Entry":  {
        "id": "2",
        "title": "Test 1",
        "person": "Test 1",
        "description": "Test 1",
        "created": "2017-07-11 20:23:02",
        "modified": "2017-07-11 20:23:02",
        "date_finished": "2017-07-11 20:22:00",
        "finished": false
      }},{"Entry":   {
        "id": "3",
        "title": "Test 2",
        "person": "Test 2",
        "description": "Test 2",
        "created": "2017-07-11 20:23:13",
        "modified": "2017-07-11 20:23:13",
        "date_finished": "2017-07-11 20:23:00",
        "finished": false
      }}]
    }));
    }])