I am unsure if this has got anything to do with AngularJS at all and if it is only JSON related.
不管怎样,让我们假设我们有以下JSON:
$scope.dataSets = {
"names": ["Horace", "Slughorn", "Severus", "Snape"],
"genders": ["Male", "Female"]
}
现在,我使用ng-Repeat指令打印上述内容,如下所示:
<div ng-repeat="data in dataSets>
//Continue readig to know what I am expcting here
</div>
我希望在<div></div>
个标签中打印"姓名"和"性别".也就是说,我希望打印JSON的密钥.我不知道 keys 是什么,因为它们可能是任何东西.我该怎么做?