Skip to content

Instantly share code, notes, and snippets.

@tkc
Created September 28, 2015 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkc/7dcfb0b390697f37f9b3 to your computer and use it in GitHub Desktop.
Save tkc/7dcfb0b390697f37f9b3 to your computer and use it in GitHub Desktop.
var getItemLists = function () {
var data = {
'item_dealer_id': global.dealer_id,
'skip': _skipCountItemLIst
};
var req = {
method: 'POST',
url: _rootListItem,
data: JSON.stringify(data)
};
$http(req)
.success(function (res) {
var list = res.data.res;
if (list.length == 0) {
_itemListsPushFlag = false;
}
_.each(list, function (v, k) {
$scope.items.push(v);
});
_skipCountItemLIst += list.length;
if (!$scope.$$phase) {
$scope.$apply();
_skipCountItemLIst += res.data.res.length;
}
_items = $scope.items;
getCategory();
})
.error(function () {
});
};
var roop = function () {
setInterval(function () {
if (_itemListsPushFlag) {
getItemLists();
}
}, 2000);
};
roop();
getItemLists();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment