Problem with data filtering


#1

Hello there,

I am facing a complicated filtering problem with my app. I have 100++ data on my json file. Using ng-repeat to show them in list and upon clicking individual showing single item. Data showing as DESC, so 1-2-3 those are bottom of my scope and my page.

My data structure :

[
  {
     "id":12,
     "zip":1215,
     "City":"Farmgate"
  },
  {
     "id":11,
     "zip":1214,
     "City":"Adabar"
  },
  {
     "id":10,
     "zip":1213,
     "City":"Dhanmondi"
  },
  {
     "id":9,
     "zip":1212,
     "City":"Mirpur"
  },
  {
     "id":8,
     "zip":1211,
     "City":"Hazaribagh"
  },
  {
     "id":7,
     "zip":1210,
     "City":"Paltan"
  },
  {
     "id":6,
     "zip":1209,
     "City":"Banani"
  },
  {
     "id":5,
     "zip":1208,
     "City":"Mohammadpur"
  },
  {
     "id":4,
     "zip":1207,
     "City":"Badda"
  },
  {
     "id":3,
     "zip":1206,
     "City":"Gulshan"
  },
  {
     "id":2,
     "zip":1205,
     "City":"Motizil"
  },
  {
     "id":1,
     "zip":1204,
     "City":"Sukrabad"
  }
]

On my detail page I am using a filtering filter:{id:whichzip} on ng-repeat which suppose get the param from URL and show individual details. The state URL is /details/:zId , when URL /#/app/details/1 the {{whichzip}} shows the exact value 1. But ng-repeat output show data from 12 because I have limit 1, I guess because it also has number “1” within it. Same case with {{whichzip}} = 2, showing output of 12. Is there anyway to get the exact value. Once again data scope is DESC so 12 will be the first to search in. I want the exact value not matching values.

Thanks


#2

I tried filter:{id:whichzip}:true and ng-repeat not repeating. But when I am giving static content it’s working, like filter:{id:1}:true. Above or inside that ng-repeat {{whichzip}} showing the dynamic value eg. 1.


#3

Finally fixed with http://jsfiddle.net/ZMkQY/146/