I have json data with following information
[
{
"city":"Bangalore",
"dob":"04-Oct-2014",
"age":24,
"maritalStatus":"Single"
},
{
"city":"Bangalore",
"dob":"04-Oct-2014",
"age":24,
"maritalStatus":"Single"
},
{
"city":"Chennai",
"dob":"04-Oct-2014",
"age":24,
"maritalStatus":"Single"
}
]
This data shown in list format
<ul class="userInfo">
<div ng-repeat="user in users " >
<li class="btn-default">
<div class="userDetails">
<div class="userPosition">{{user.city}}</div>
</div>
</li>
</div>
</ul>
During HTTP request
userDirectory.controller("userListControl", function($scope,$rootScope, $http)
{
$http.get('data/userData.json').success (function(data){
$scope.users = data;
var usersDb = TAFFY();
usersDb.insert(data);
});
});
Here, The data is coming from userData.json file.
My Question is,
Before the loading page. I will declare city = "bangalore".
So based on city. I have to show the data based on city. I want to avoid other datas except city:bangalore from json.
How can i filter particular city datas. I dont want use filter function. I have to filter at this stage
$scope.users = data; Because i am using JS Db here. Then only i can store these data here and process in future