【发布时间】:2016-11-01 03:54:48
【问题描述】:
请帮助我理解。我无法获得 ng-repeat 的键值数组(在 blockquote 中)。没有显示任何内容,控制台中也没有错误。 这是我修改后的代码:
<div class="row row-content" ng-controller = "DishDetailController">
<blockquote ng-repeat="comment in dish">
<p>{{comment.rating}} Stars</p>
<p>{{comment.comment}}</p>
<footer>John Lemon</footer>
</blockquote>
</div>
脚本:
angular.module('confusionApp', [])
.controller('DishDetailController', ['$scope', function($scope) {
var dish=[{
name:'Uthapizza',
image: 'images/uthapizza.png',
category: 'mains',
label:'Hot',
price:'4.99',
description:'A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.',
comment: [
{
rating:5,
comment:"Imagine all the eatables, living in conFusion!",
author:"John Lemon",
date:"2012-10-16T17:57:28.556094Z"
},
{
rating:4,
comment:"Sends anyone to heaven, I wish I could get my mother-in-law to eat it!",
author:"Paul McVites",
date:"2014-09-05T17:57:28.556094Z"
},
]
}
];
$scope.dish = dish;
}]);
【问题讨论】:
-
@swen 你检查答案了吗
-
不幸的是它不起作用。我更新了问题代码
-
您是否在控制台中看到任何错误?
-
不,没有错误
-
我可以获取团队查看器吗?
标签: javascript angularjs arrays key ng-repeat