Filtering a Firebase list by another Firebase Object in Angularjs -


so have big firebase list want filter using firebase object binding to. if not bind 'search' object firebase filters fine, when bind firebase returns 0 results.

my controller:

  .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> 

a sample 'search' object:

{   "constant": true,   "intermittent": true,   "localized": true,   "referred": false,   "region": "hip" } 

a sample of 'diagnoses' firebase object/list:

{   "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" } 

how filter correctly?
...and thank in advance!

the issue object returned $bind contains several $ methods angular trying filter against.

try this...

syncdata('tests/' + $routeparams.id + '/specs').$bind($scope, 'searchdirty'); $scope.$watch('searchdirty', function (search) {     $scope.search = angular.fromjson(angular.tojson(search)); }); 

this strip out $ methods/values , return raw value of data.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -