javascript - Pull a random number of items out of an Angular JS data source? -
i've searched , can find things related random item, want (for example) 7 random items larger group of items.
so right have code gets me first 7 items in data, want pull 6 random items instead.
<ul class="block-grid-4"> <li ng-repeat="icon in icons | limitto:7"><i class="fa fa-fw fa-{{icon.id}}"></i> fa-{{icon.id}}</li> </ul>
how can 7 (or arbitrary number) items?
my service
.factory('faiconfactory', ['$http', function($http) { return { geticons: function() { var icons = $http.get('scripts/data/fa_icons.js').then(function(response) { return response.data.icons; }); return icons; } }; } ]);
Comments
Post a Comment