我认为有此代码
<div ng-repeat="config in configs">
<div ng-repeat="test in tests ">
<a href="#"> {{test[config.Name]}}</a></li>
</div>
</div>
效果很好。但如何过滤测试呢?
<div ng-repeat="test in Tests | filter:{[config.Name]:'Test'} ">
不工作。如何过滤列 config.Name?
感谢您的帮助
斯特凡
最佳答案
将该函数添加到您的 Controller :
$scope.createFilter = function(property, value) {
var result = {};
result[property] = value;
return result;
};
并在 View 中使用它:
<div ng-repeat="test in Tests | filter: createFilter(config.Name, 'Test')">
关于angularjs - 如何在 View 中进行过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32791114/