0

All code here: http://stevendavisphoto.com/mc/

Filter: <input type="text" ng-model="search">
<tr ng-repeat="(id, group) in groups | filter:search" class="editing-{{group.editing}}">

I want the rows to filter out if they don't match what's in the input. It doesn't seem to do anything. I know {{search}} is changing, but the filter isn't working.

StevenDavisPhoto
  • 160
  • 1
  • 12
  • 1
    possible duplicate of [Filter in ng-options not working](http://stackoverflow.com/questions/23703514/filter-in-ng-options-not-working) – Blackhole Jun 03 '14 at 19:52
  • i don't think so, but i could be wrong. i'm following the simple examples here... http://sarahbranon.com/post/69604997957/fun-with-angularjs-filters-part-1-the-filter. not sure the issue. – StevenDavisPhoto Jun 03 '14 at 19:55
  • Can you post sample of data in `groups` variable here? – Blackhole Jun 03 '14 at 19:56
  • {"mcGroups":{"-JOW5khdCmt21Sbviuo0":{"location":"Niles","type":"Mixed","leader":"Melissa Moy","time":"7:30pm","email":"moystress@aol.com","day":"Wednesday"}}} – StevenDavisPhoto Jun 03 '14 at 19:59
  • I mean, at least two lines :) ? – Blackhole Jun 03 '14 at 20:00
  • I'm using firebase for my API backend... {"mcGroups":{"-JOYJMIeKyD3ZqAr3wb4":{"location":"fdsfds","type":"Womens","leader":"Steve","time":"12:30am","day":"Wednesday"},"-JOW5khdCmt21Sbviuo0":{"location":"Niles","type":"Mixed","leader":"Melissa Moy","time":"7:30pm","email":"moystress@aol.com","day":"Wednesday"}}} – StevenDavisPhoto Jun 03 '14 at 20:01
  • 1
    It looks like the data is in an object instead of an array. Filters only work on arrays. – Jerrad Jun 03 '14 at 20:04
  • 1
    Ya. So basically you've an object, not an array. Please have a look at the post I've provided. – Blackhole Jun 03 '14 at 20:04
  • 2
    [This one](http://stackoverflow.com/questions/14788652/how-to-filter-key-value-with-ng-repeat-in-angularjs) too. – Jerrad Jun 03 '14 at 20:05
  • @Jerrad Didn't know this one. A far better duplicate :) ! – Blackhole Jun 03 '14 at 20:07
  • blackhole, i've added your solution here http://stevendavisphoto.com/mc/ and it works, but it adds a bunch of empty rows to the dataset? – StevenDavisPhoto Jun 03 '14 at 20:19
  • ah, this is why... https://github.com/firebase/angularFire/issues/84 ... firebase doesn't use arrays, but objects... i think the empty rows are due to functions in the object being added? – StevenDavisPhoto Jun 03 '14 at 20:28
  • ah, found an easy solution built in with angularfire... http://ericsaupe.com/angularfire-filtering-data-returned-by-firebase/ – StevenDavisPhoto Jun 03 '14 at 20:33

1 Answers1

0

The orderByPriority filter is provided by AngularFire to convert an object returned by $firebase into an array. The objects in the array are ordered by priority (as defined in Firebase). Additionally, each object in the array will have a$id property defined on it, which will correspond to the key name for that object.

http://ericsaupe.com/angularfire-filtering-data-returned-by-firebase/

StevenDavisPhoto
  • 160
  • 1
  • 12