[英]Why isn't my ng-repeat working?
I've tempted to do an ng-repeat that will retrieve card titles and place them into a list. 我很想做一个ng-repeat,它将检索卡片标题并将它们放入列表中。 Here is a section from my code that calls the content:
这是我的代码中调用内容的部分:
<ion-content class="has-header" scroll="false" ng-controller="MainCtrl">
<div id="accordian">
<ul>
<li>
<h3><span class="icon-dashboard" ng-repeat="card in cards"></span>Group 1</h3>
<ul>
<li><a href="#">{{ card.title }}</a></li>
</ul>
</li>
Here is the controller: 这是控制器:
.controller('MainCtrl', function($scope,$http) {
// Card Array
$scope.data = {};
$scope.cards =[
{checked: false, title:'Bank', src:'img/bank.png',details:'Description will go here!'},
{checked: false, title:'BBVA', src:'img/bbva.png',details:'Description will go here!'},
{checked: false, title:'Nike', src:'img/nike.png',details:'Description will go here!'},
];
Your current code will repeat the span
tag for each card
that you have inside cards
. 您当前的代码将重复
span
标签为每个card
,你有内cards
。 I don't think that's what you intended to do. 我不认为这是您打算要做的。 You probably want to repeat the
li
, right? 您可能想重复一下
li
,对吗? Try this instead: 尝试以下方法:
<li ng-repeat="card in cards">
<h3><span class="icon-dashboard"></span>Group 1</h3>
<ul>
<li><a href="#">{{ card.title }}</a></li>
</ul>
</li>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.