9,058 questions
441
votes
27
answers
421k
views
Way to ng-repeat defined number of times instead of repeating over array?
Is there a way to ng-repeat a defined number of times instead of always having to iterate over an array?
For example, below I want the list item to show up 5 times assuming $scope.number equal to 5 ...
489
votes
10
answers
350k
views
Angular ng-repeat Error "Duplicates in a repeater are not allowed."
I am defining a custom filter like so:
<div class="idea item" ng-repeat="item in items" isoatom>
<div class="section comment clearfix" ng-repeat="comment in item.comments | range:1:2"...
717
votes
8
answers
596k
views
How to iterate over the keys and values with ng-repeat in AngularJS?
In my controller, I have data like:
$scope.object = data
Now this data is the dictionary with keys and values from json.
I can access the attribute with object.name in the template. Is there any way ...
502
votes
12
answers
877k
views
ng-repeat :filter by single field
I have an array of products that I'm repeating over using ng-repeat and am using
<div ng-repeat="product in products | filter:by_colour">
to filter these products by colour. The filter is ...
258
votes
24
answers
640k
views
AngularJS For Loop with Numbers & Ranges
Angular does provide some support for a for loop using numbers within its HTML directives:
<div data-ng-repeat="i in [1,2,3,4,5]">
do something
</div>
But if your scope variable ...
378
votes
10
answers
239k
views
AngularJS ng-repeat handle empty list case
I thought this would be a very common thing, but I couldn't find how to handle it in AngularJS. Let's say I have a list of events and want to output them with AngularJS, then that's pretty easy:
<...
212
votes
15
answers
212k
views
ng-repeat finish event
I want to call some jQuery function targeting div with table. That table is populated with ng-repeat.
When I call it on
$(document).ready()
I have no result.
Also
$scope.$on('$...
231
votes
17
answers
191k
views
angular ng-repeat in reverse
How can i get a reversed array in angular?
i'm trying to use orderBy filter, but it needs a predicate(e.g. 'name') to sort:
<tr ng-repeat="friend in friends | orderBy:'name':true">
<td&...
1
vote
1
answer
55
views
Custom widget for visualizing dynamic table data
While creating a custom widget for visualizing dynamic table data, I encountered some issues and would like to share a minimal working example to illustrate the problem.
JS:
self.ctx.$scope.showAlert =...
391
votes
8
answers
209k
views
orderBy multiple fields in Angular
How to sort by using multiple fields at same time in angular? fist by group and then by sub-group
for Example
$scope.divisions = [{'group':1,'sub':1}, {'group':2,'sub':10}, {'group':1,'sub':2},{'group'...
401
votes
7
answers
489k
views
Adding parameter to ng-click function inside ng-repeat doesn't seem to work
I have a simple loop with ng-repeat like this:
<li ng-repeat='task in tasks'>
<p> {{task.name}}
<button ng-click="removeTask({{task.id}})">remove</button>
</li>
...
335
votes
6
answers
195k
views
passing 2 $index values within nested ng-repeat
So I have an ng-repeat nested within another ng-repeat in order to build a nav menu. On each <li> on the inner ng-repeat loop I set an ng-click which calls the relevant controller for that menu ...
187
votes
10
answers
169k
views
Preserve line breaks in angularjs
I have seen this SO question.
My code instead of ng-bind="item.desc" uses {{item.desc}} because I have a ng-repeat before.
So my code:
<div ng-repeat="item in items">
{{item.description}}
&...
111
votes
20
answers
262k
views
Calculating sum of repeated elements in AngularJS ng-repeat
The script below displays a shop cart using ng-repeat. For each element in the array, it shows the item name, its amount and the subtotal (product.price * product.quantity).
What is the simplest way ...
124
votes
21
answers
167k
views
how to split the ng-repeat data with three columns using bootstrap
I am using ng-repeat with my code I have 'n' number of text box based on ng-repeat. I want to align the textbox with three columns.
this is my code
<div class="control-group" ng-repeat="oneExt in ...