ng-repeat is commented out on chrome inspect
I can't seem to figure out how to get my ng-repeat to work. I can see that the correct information is scoped properly, but when I inspect the HTML in dev tools, the first line below is commented out and the cards don't show up. Any suggestions?
我似乎想不出如何让我的ng重复工作。我可以看到正确的信息是正确的,但是当我在dev工具中检查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
});
UPDATE
Here is a screenshot of the AngularJS scope showing events are being scoped properly
这里是AngularJS范围显示事件的屏幕截图。
2 个解决方案
#1
1
Firstly, you must to be sure that yours controllers works properly and goes inside html template.
首先,您必须确保您的控制器正常工作并进入html模板。
Than $scope.matchedArtists - is an Array of objects in yours case
亿美元的范围。matchedArtists——是您的案例中的一组对象。
$scope.matchedArtists = [{artist: 'ártist', date: 'date', venue: 'venue '},
{artist: 'ártist2', date: 'date2', venue: 'venue2'}]
#2
0
Debugging AngularJS Problems
To quickly test the variable on scope:
快速测试范围内的变量:
matchedArtists={{matchedArtists | json}} scope={{$id}}
<div ng-repeat="matchedArtist in matchedArtists">
<div class="centerPandora">
<div class="row">
<div class="col-med-12">
Using the inspection console, click on the element of interest:
使用检查控制台,单击感兴趣的元素:
>scope=angular.element($0).scope()
>console.dir(scope)
There are several possible reasons the data is not showing:
数据不显示的原因有几个:
- The template is part of an isolate scope;
- 模板是隔离范围的一部分;
- The controller is on a sibling element;
- 控制器位于兄弟元素上;
- The controller was instantiated with
controllerAs
syntax; - 控制器实例化了控制器的语法;
#1
1
Firstly, you must to be sure that yours controllers works properly and goes inside html template.
首先,您必须确保您的控制器正常工作并进入html模板。
Than $scope.matchedArtists - is an Array of objects in yours case
亿美元的范围。matchedArtists——是您的案例中的一组对象。
$scope.matchedArtists = [{artist: 'ártist', date: 'date', venue: 'venue '},
{artist: 'ártist2', date: 'date2', venue: 'venue2'}]
#2
0
Debugging AngularJS Problems
To quickly test the variable on scope:
快速测试范围内的变量:
matchedArtists={{matchedArtists | json}} scope={{$id}}
<div ng-repeat="matchedArtist in matchedArtists">
<div class="centerPandora">
<div class="row">
<div class="col-med-12">
Using the inspection console, click on the element of interest:
使用检查控制台,单击感兴趣的元素:
>scope=angular.element($0).scope()
>console.dir(scope)
There are several possible reasons the data is not showing:
数据不显示的原因有几个:
- The template is part of an isolate scope;
- 模板是隔离范围的一部分;
- The controller is on a sibling element;
- 控制器位于兄弟元素上;
- The controller was instantiated with
controllerAs
syntax; - 控制器实例化了控制器的语法;