Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 我能';我似乎不知道如何让我的ng repeat发挥作用 ng repeat在chrome inspect上被注释掉_Angularjs_Angularjs Ng Repeat - Fatal编程技术网

Angularjs 我能';我似乎不知道如何让我的ng repeat发挥作用 ng repeat在chrome inspect上被注释掉

Angularjs 我能';我似乎不知道如何让我的ng repeat发挥作用 ng repeat在chrome inspect上被注释掉,angularjs,angularjs-ng-repeat,Angularjs,Angularjs Ng Repeat,我似乎不知道如何让我的ng repeat工作。我可以看到正确的信息的作用域是正确的,但是当我在dev工具中检查HTML时,下面的第一行被注释掉了,并且卡片没有显示出来。有什么建议吗 <div ng-repeat="matchedArtist in matchedArtists"> <div class="centerPandora"> <div class="row"> <div class="col-med-12"&

我似乎不知道如何让我的ng repeat工作。我可以看到正确的信息的作用域是正确的,但是当我在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>
更新


首先,您必须确保您的控制器工作正常,并进入html模板

$scope.matchedArtists以上-是您案例中的一个对象数组

$scope.matchedArtists = [{artist: 'ártist', date: 'date', venue: 'venue '},
{artist: 'ártist2', date: 'date2', venue: 'venue2'}]
调试AngularJS问题 要在作用域上快速测试变量,请执行以下操作:

matchedArtists={{matchedArtists | json}} scope={{$id}}
<div ng-repeat="matchedArtist in matchedArtists">
    <div class="centerPandora">
      <div class="row">
        <div class="col-med-12">
数据未显示的原因有几个:

  • 模板是隔离范围的一部分
  • 控制器位于同级元素上
  • controllerAs
    语法实例化控制器
    $scope.matchedArtists=matchedArtists
    应该做什么?你试过调试你的代码吗?添加了一些console.log()语句。
    ng repeat
    使用注释节点作为基础构建DOM。如果repeat表达式不包含数据,则不会生成DOM。您如何知道正确的信息范围正确?所描述的问题表明情况并非如此。
    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)