,可以通过在ngRepeat指令中使用过滤器来实现。具体步骤如下:
<div ng-repeat="item in items | filter: {id: 'certan'}">
{{ item }}
</div>
app.controller('myController', function($scope) {
$scope.items = [
{id: 'certan', name: 'Object 1'},
{id: 'other', name: 'Object 2'},
{id: 'certan', name: 'Object 3'}
];
});
在上述代码中,ng-repeat指令会遍历items数组,并使用过滤器{ id: 'certan' }来筛选出具有id为'certan'的对象进行展示。
关于ngRepeat的更多用法和参数,可以参考腾讯云的AngularJS文档:ngRepeat。
请注意,以上答案是基于AngularJS的ngRepeat指令,如果需要使用Angular的版本,请参考相关文档进行调整。
没有搜到相关的文章