I'am developing a cross platform angularjs mobile application. in it there is a requirement to display some data. Now i have stored that data as json file. This json file contains nearly 2500 products. The below code works just fine. Now the problem is that when i deploy the following code in mobile it literally takes 12 - 14 seconds to iterate through json and display data.
The size of the json file is not the problem. at first the json file were 1.2 mb, i removed unwanted fields and reduced it to 320kb and also minified it. but the iteration time takes for the process is still the same.
I'am planning to display complete product details on clicking on each field, it will work fine though but when the user click back and go to the main listing page after viewing a single product details, it will take 12 - 14 seconds each time which is unacceptable.
Can someone suggest a better idea that is not time consuming to display this much data? I thought about converting this whole json to a SQLite db file and accessing it via query.
I'am not an advanced angularjs programmer (still learning) that's why i lay everything that is in front of me. Some good help will be very much appreciated.
Edit.
What if iam planning to add a textbox and display filtered data by adding an ng-model? whenever i type a text in textbox it will iterate through whole 2500 records. When it comes to mobile then it will be a dead end.
JSON File. [product.json]
[{"ProductCode":"000001","Description":"Product1","UOMml":"100","ShopAfterST":"150"},
....
....
....
}]
My controller.
myAppControllers.controller("ProductListCtrl", function($scope, $http) {
$http.get('json/product.json').success (function(data){
$scope.ProdList = data;
});
});
My template html.
<div ng-controller="ProductListCtrl">
<div ng-repeat="item in liquorProdList | orderBy:'Description'" >
<p > {{item.Description}} </p>
</div>
</div>