我正在使用angularJS并拥有一个javascript对象数组,每个对象都有
Count
ID
Subject
我想使用这个数组来填充这些值:
<dl>
<dt>Count</dt>
<dd>Subject</dd>
<!--all objects should appear as above-->
</dl>
有办法做到这一点吗?
答案 0 :(得分:1)
$scope.yourArray = [
{"Count": "something1", "ID": "something2", "Subject": "something3"},
{"Count": "something1", "ID": "something2", "Subject": "something3"},
{"Count": "something1", "ID": "something2", "Subject": "something3"},
{"Count": "something1", "ID": "something2", "Subject": "something3"}
]; // On the controller
<dl ng-repeat="item in yourArray">
<dt>{{item.Count}}</dt>
<dd>{{item.Subject}}</dd>
</dl>
答案 1 :(得分:1)
试试这个:
<dl ng-repeat="myDataItem in myDataArr">
<dt>{{ myDataItem.Count }}</dt>
<dd>{{ myDataItem.Subject }}</dd>
</dl>