因此,我有一个大的防火墙列表,我想使用绑定到的另一个firebase对象进行筛选。如果我没有将我的'search‘对象绑定到firebase,它会很好地过滤,但是当我绑定到Firebase时,它会返回零结果。
我的控制器:
.controller('TestResultsCtrl', ['$scope', 'syncData', '$routeParams', '$firebase', '$filter', function($scope, syncData, $routeParams, $firebase, $filter) {
$scope.id = $routeParams.id;
syncData('tests/' + $routeParams.id).$bind($scope, 'test');
syncData('tests/' + $routeParams.id + '/specs').$bind($scope, 'search');
syncData('diagnoses').$bind($scope, 'all_diagnoses');
}])my view:
<a href="" ng-repeat="diagnoses in all_diagnoses | orderByPriority | filter:search" class="list-group-item">{{diagnoses.title}}</a>一个样本“搜索”对象:
{
"constant": true,
"intermittent": true,
"localized": true,
"referred": false,
"region": "hip"
}“诊断”对象/列表的示例:
{
"constant": true,
"intermittent": true,
"localized": true,
"referred": false,
"region": "hip",
"title": "Hip Osteoarthritis"
},
{
"constant": true,
"intermittent": false,
"localized": false,
"referred": true,
"region": "neck",
"title": "Whiplash"
}如何使它正确地过滤?
...and,提前谢谢你!
发布于 2014-04-16 17:29:43
问题可能是从$bind返回的对象包含了几个$方法,这些方法是角想要过滤的。
试试这样的..。
syncData('tests/' + $routeParams.id + '/specs').$bind($scope, 'searchDirty');
$scope.$watch('searchDirty', function (search) {
$scope.search = angular.fromJson(angular.toJson(search));
});这将去掉任何$方法/值,并返回数据的原始值。
https://stackoverflow.com/questions/23050002
复制相似问题