I have this kind of problem, I have my database with 600k results, I have a web service REST created by me, so I have file json of my request query. Now I have my json file in my angular app mobile, but with my coding it freeze so much because, I take all entire file json and do a listbox and after show entire listbox i can search, when I type anything it freeze, and my search work in real-time, I don't care if i lost this functionality, I want to search without freeze, but i don't know how to solve this problem.
I have my db mysql, and a sample result of my request is this(JSON):
[
{
"date": "2009-02-14",
"pool": 2,
"timing": "H",
"federation": "A2",
"id_race": 73633,
"id_com": 91
},
{
"date": "2009-02-14",
"pool": 2,
"timing": "J",
"federation": "A2",
"id_race": 7348,
"id_com": 91
},
{
"date": "2009-02-14",
"pool": 2,
"timing": "J",
"federation": "A2",
"id_race": 2397,
"id_com": 223
},
...
]
My AngularJS controller html is this:
<div ui-content-for="title">
<span class="small">Search:<input ng-model="query"></span>
</div>
<div class="scrollable">
<div class="scrollable-content">
<div class="list-group">
<div class="list-group-item" ng-repeat="race in raceList | filter:query">
<br />
<span>{{race.date}} - {{race.federation}} - {{race.pool}} - {{race.timing}}</span>
</div>
</div>
</div>
</div>
And my controller js is this:
'use strict';
var raceControllerModule = angular.module('raceControllerModule', ['appServiceModule']);
raceControllerModule.controller('raceController',
['$scope', '$routeParams', 'appService', function($scope, $routeParams, appService) {
$scope.raceList = [];
appService.newRacePromise().then(function (response) {
$scope.raceList = response.data;
});
}]);
when I search i'd like to no freeze so somethings like I before type and with a button take my results, the search can be done from date or pool or federation.
EDIT: appService.js
'use strict';
var appServiceModule = angular.module(‘appServiceModule', []);
appServiceModule.factory(‘appService', ['$http', function ($http) {
var BASE_URL_ = "../api/";
var service = {};
service.newRacePromise = function () {
return $http.get(BASE_URL_ + 'races’);
};
return service;
}]);