Search and order of the elements

Asked

Viewed 19 times

0

If I have a data set containing 50 elements, of those 50 I need there to be an iteration to show 10 out of 10, the first 10 and then successively. If within this same set with 50 elements I need to search for something that has in this set, when deleted it has to return the first 10 elements.

How do I do this with Angularjs?

The query works but when I delete the searched word it returns all the elements of the set.

scope.$watch('q', function(newValue, oldValue) {
 if (oldValue != null){
  $http.get('/api/services.json?q=' + newValue)
  	.success(function (data) {
  	   $scope.services = data;
  	  });
	 }
	}, true);

  • Your question is very confusing. I suggest you give a practical example of what you want to do to make it clear.

  • I have a set of 50 elements served on a website locally, these elements are paginated 10 to 10, the page on which these elements are displayed has a search, when the search is executed it returns perfectly the element in the set, if you think, if you delete the search done there the page loads all the elements to be shown, ignore the pagination!

  • tried a direct filter in ng-repeat ?

  • The filtering for return of the searched element is working, what is even problem is that when deletes the search made it returns all the elements of the set and was to return only the first 10.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.