我似乎无法弄清楚如何让我的ng-repeat工作。我可以看到正确的信息是正确的,但是当我在开发工具中检查HTML时,下面的第一行被注释掉,并且卡片没有显示出来。有什么建议?
<div ng-repeat="matchedArtist in matchedArtists">
<div class="centerPandora">
<div class="row">
<div class="col-med-12">
<div class="content">
<div class="card">
<div class="firstinfo">
<img src="#" />
<div class="profileinfo">
<h1>{{ matchedArtist.artist }}</h1>
<h3>{{ matchedArtist.date }}</h3>
<h4>{{ matchedArtist.venue }}</h4>
<p class="bio"></p>
<a href="#">
<font color="black">Click for event details</font>
</a>
</div>
</div>
</div>
<div class="badgescard info"><span id="days"></span><span
id="hours"></span><span id="minutes"></span><span id="seconds"></span>
</div>
</div>
</div>
</div>
</div><br /><br /><br /><br />
</div>
'use strict';
var concertList =
angular.module('concertList').controller('ConcertListCtrl',
function($scope){
function hideLogin($scope) {
$scope.advstatus = true;
};
$scope.matchedArtists = matchedArtists
});
Here is a screenshot of the AngularJS scope showing events are being scoped properly
答案 0 :(得分:1)
首先,您必须确保您的控制器正常工作并进入html模板。
比$ scope.matchedArtists - 在你的情况下是一个对象数组
$scope.matchedArtists = [{artist: 'ártist', date: 'date', venue: 'venue '},
{artist: 'ártist2', date: 'date2', venue: 'venue2'}]
答案 1 :(得分:0)
快速测试范围变量:
matchedArtists={{matchedArtists | json}} scope={{$id}}
<div ng-repeat="matchedArtist in matchedArtists">
<div class="centerPandora">
<div class="row">
<div class="col-med-12">
使用检查控制台,单击感兴趣的元素:
>scope=angular.element($0).scope()
>console.dir(scope)
数据未显示有几种可能的原因:
controllerAs
语法实例化;