我需要像下面提到的那样重复一堆divs
。我想迭代并填充列表中的每个对象。在下面的代码中,他们为每个列表项单独输入。但我希望从棱角分明的物体中得到它。我完全被困了。对象将具有内容数据并链接到该图片。
<div class="panel-body">
<div class="media"> <a class="pull-left kit-avatar kit-avatar-36" href="#"> <img class="media-object" src="images/dummy/uifaces1.jpg" alt=""> </a>
<div class="media-body">
<div class="pull-right">
<div class="btn-group btn-group-xs"> <a href="#" rel="tooltip" title="Attend Test" class="btn btn-default"><i class="fa fa-check fa-fw"></i>Going To Attend Test</a> </div>
<!-- /.btn-group -->
</div>
<!-- /.pull-right -->
<h5 class="media-heading"><a href="#">Purchase 4 items ($80)</a></h5>
<div class="text-muted"> <small><i class="fa fa-user fa-fw"></i> Rose Davies</small> <small><i class="fa fa-user fa-fw"></i> 16 minutes</small> </div>
</div>
<!-- /.media-body -->
</div>
<!-- /.media -->
<hr>
<div class="media"> <a class="pull-left kit-avatar kit-avatar-36" href="#"> <img class="media-object" src="images/dummy/uifaces2.jpg" alt=""> </a>
<div class="media-body">
<div class="pull-right">
<div class="btn-group btn-group-xs"> <a href="#" rel="tooltip" title="approve" class="btn btn-default"><i class="fa fa-check fa-fw"></i></a> <a href="#" rel="tooltip" title="invoice" class="btn btn-default"><i class="fa fa-credit-card fa-fw"></i></a> <a href="#" rel="tooltip" title="delete" class="btn btn-default"><i class="fa fa-times fa-fw"></i></a> </div>
<!-- /.btn-group -->
</div>
<!-- /.pull-right -->
<h5 class="media-heading"><a href="#">Purchase an item - Wrapkit Admin Template</a></h5>
<div class="text-muted"> <small><i class="fa fa-user fa-fw"></i> Dilara Elmas</small> <small><i class="fa fa-user fa-fw"></i> 20 minutes</small> </div>
</div>
<!-- /.media-body -->
</div>
<!-- /.media -->
<hr>
<div class="media"> <a class="pull-left kit-avatar kit-avatar-36" href="#"> <img class="media-object" src="images/dummy/uifaces3.jpg" alt=""> </a>
<div class="media-body">
<div class="pull-right">
<div class="btn-group btn-group-xs"> <a href="#" rel="tooltip" title="approve" class="btn btn-default"><i class="fa fa-check fa-fw"></i></a> <a href="#" rel="tooltip" title="invoice" class="btn btn-default"><i class="fa fa-credit-card fa-fw"></i></a> <a href="#" rel="tooltip" title="delete" class="btn btn-default"><i class="fa fa-times fa-fw"></i></a> </div>
<!-- /.btn-group -->
</div>
<!-- /.pull-right -->
<h5 class="media-heading"><a href="#">Payment for invoice #141213</a></h5>
<div class="text-muted"> <small><i class="fa fa-user fa-fw"></i> George Florianu</small> <small><i class="fa fa-user fa-fw"></i> 42 minutes</small> </div>
</div>
<!-- /.media-body -->
</div>
<!-- /.media -->
<hr>
<div class="media"> <a class="pull-left kit-avatar kit-avatar-36" href="#"> <img class="media-object" src="images/dummy/uifaces4.jpg" alt=""> </a>
<div class="media-body">
<div class="pull-right">
<div class="btn-group btn-group-xs"> <a href="#" rel="tooltip" title="approve" class="btn btn-default"><i class="fa fa-check fa-fw"></i></a> <a href="#" rel="tooltip" title="invoice" class="btn btn-default"><i class="fa fa-credit-card fa-fw"></i></a> <a href="#" rel="tooltip" title="delete" class="btn btn-default"><i class="fa fa-times fa-fw"></i></a> </div>
<!-- /.btn-group -->
</div>
<!-- /.pull-right -->
<h5 class="media-heading"><a href="#">Purchase an item - Wrapkit Admin Template</a></h5>
<div class="text-muted"> <small><i class="fa fa-user fa-fw"></i> Gustavo Francisco</small> <small><i class="fa fa-user fa-fw"></i> 1 hours</small> </div>
</div>
<!-- /.media-body -->
</div>
<!-- /.media -->
<hr>
<div class="media"> <a class="pull-left kit-avatar kit-avatar-36" href="#"> <img class="media-object" src="images/dummy/uifaces5.jpg" alt=""> </a>
<div class="media-body">
<div class="pull-right">
<div class="btn-group btn-group-xs"> <a href="#" rel="tooltip" title="approve" class="btn btn-default"><i class="fa fa-check fa-fw"></i></a> <a href="#" rel="tooltip" title="invoice" class="btn btn-default"><i class="fa fa-credit-card fa-fw"></i></a> <a href="#" rel="tooltip" title="delete" class="btn btn-default"><i class="fa fa-times fa-fw"></i></a> </div>
<!-- /.btn-group -->
</div>
<!-- /.pull-right -->
<h5 class="media-heading"><a href="#">Purchase an item - Wrapkit Admin Template</a></h5>
<div class="text-muted"> <small><i class="fa fa-user fa-fw"></i> Bastien Guichard</small> <small><i class="fa fa-user fa-fw"></i> 1 hours</small> </div>
</div>
<!-- /.media-body -->
</div>
<!-- /.media -->
</div>
我只在table data
使用了ng-repeat。是否可以填充整个对象并重复迭代。
答案 0 :(得分:1)
您可以采用与以下类似的方式执行此操作:
<div class="media" ng-repeat="media in mediaList track by $index"> <a class="pull-left kit-avatar kit-avatar-36" href="#"> <img class="media-object" src="images/dummy/uifaces1.jpg" alt=""> </a>
<div class="media-body">
<div class="pull-right">
<div class="btn-group btn-group-xs"> <a href="#" rel="tooltip" title="Attend Test" class="btn btn-default"><i class="fa fa-check fa-fw"></i>{{media.text1}}</a> </div>
<!-- /.btn-group -->
</div>
<!-- /.pull-right -->
<h5 class="media-heading"><a href="#">{{media.text2}}</a></h5>
<div class="text-muted"> <small><i class="fa fa-user fa-fw"></i>{{media.text3}}</small> <small><i class="fa fa-user fa-fw"></i>{{media.text4}}</small> </div>
</div>
<!-- /.media-body -->
</div>