【发布时间】:2016-08-06 09:24:08
【问题描述】:
我有一个连接到数组中不同对象的名称列表。我想,每当您单击其中一个名称时,获取值并将它们输出到与该对象相对应的另一个列表中。现在我 console.log 正确的值,但不知道如何输出它:
<a href="#" id="name" ng-click="updateIndex($index);">{{ person.name }}</a>
控制器:
$scope.updateIndex = function(index) {
console.log($scope.person[index]); //Logs the right values
}
如何从对象中输出被点击名称的值:
<div class="wrap" ng-repeat="per in person">
<div class="box">
{{ person.name }}
</div>
<div class="box">
{{ person.age }}
</div>
<div class="box">
{{ person.town }}
</div>
<div class="box">
{{ person.country }}
</div>
<div class="box">
{{ person.gender }}
</div>
</div>
谢谢!
【问题讨论】:
-
output the values from the object是什么意思?
标签: javascript angularjs arrays filter