Questions tagged [angularjs-track-by]
51 questions
2
votes
1 answer
Angular: What do you do when you need to 'track by' but you don't have a unique property to track by?
Say that I'm ng-repeating over images, which is an array of objects that have a src and a caption property.
var images = [
{src: 'a.jpg', caption: 'a'},
{src: 'b.jpg', caption: 'b'},
{src: 'c.jpg', caption: 'c'},
{src: 'd.jpg', caption:…

Adam Zerner
- 17,797
- 15
- 90
- 156
1
vote
3 answers
Browser freezes when using mat-select with ngFor without trackBy
TL;DR: I already have working solutions, but I would like explanations why mat-select behaves like this.
While building an application with Angular Material I run into this error when using mat-select combined with *ngFor in the template: the get…

adrisons
- 3,443
- 3
- 32
- 48
1
vote
0 answers
Angularjs When to use track-by over select-as in ng-options directive
I would like to know in which situations is recommended to use track by over select as in ng-options directive?
Here we have the two options:
1
vote
0 answers
Angular Binding field to Dynamic model modifies all values in object
So I have this code in view:
…

User315123
- 11
- 3
1
vote
2 answers
How do I reset a select list in AngularJS and track by?
I have a select list.
I reset the list
$scope.reset = function () {
$scope.search =…

Interlated
- 5,108
- 6
- 48
- 79
1
vote
1 answer
ng-init is not calling second time when track by $index used
html:
controller:
$scope.initUserDecision = function(row,index){
…
{{employeeName}} |

SivaRajini
- 7,225
- 21
- 81
- 128
1
vote
2 answers
ng-repeat track by $index not working with pagination
I'm working with ng-repeat + Filter + Pagination(ui-bootstrap)
1- ng-repeat + filter is working fine :
2- ng-repeat + filter + pagination is working fine too:

Inoubli
- 374
- 2
- 11
1
vote
1 answer
Where to add 'track by $index' when using Filter and Pagination in the same ng-repeat
I have my ng-repeat and filter ,then I added bootstrap-ui pagination and everything working fine
To add fields Edit, I needed to use 'track by $index' but I cant find the correct way to add it to my ng-repeat,
This is my HTML view :

Inoubli
- 374
- 2
- 11
1
vote
2 answers
angular material md-select using track by but still getting $$hashKey
I'm trying to get rid of the $$hashKey value that angular adds to your model value. According to most sources implementing a track by should solve this issue but I'm doing something wrong.
The vm.productTypes is any array of objects with id…

Tersius
- 267
- 4
- 17
1
vote
1 answer
General angular ng-repeat and track by $index
Just a general question about using track by $index in an ng-repeat, I couldn't find a solution in the docs...
I have a
{{concert}}
, below it, I have an array, that is dynamically populated…
Quade Dumont
- 175
- 9
1
vote
1 answer
How to resolve angular ng-options track by deep clone issue?
ng-options="branch as branch.name for branch in ordersItemClientInfo.branches track by branch.id"
In my case "branches" is an array of object and each of them have field ref to so deep object (map geoObject). Angular tries to copy thats object and…

nitro-n
- 423
- 1
- 5
- 9
1
vote
1 answer
Angular ng-options with track by creates unknown option element
My goal here is to generate a select list that has the option values set to one of my objects properties. When adding the track by binding option to the ng-options directive an unknown option element is created and it is the only option that ever…

HisDivineShadow
- 1,036
- 1
- 12
- 21
1
vote
0 answers
ng-repeat track by with hashKey default
Question:
Is it possible to define an ng-repeat track by expression which will use a particular attribute if it exists, but use the default $$hashKey behavior if that attribute is undefined?
Context:
I have a chat application which displays an array…

David
- 335
- 4
- 14
0
votes
2 answers
ngFor trackBy is not identifying items correctly using ngModel
I will be brief.
Here's the problem on stackblitz: trackByBugntfree\
Explanation:
Resources contain ppermission that are displayed on screen with checkboxes.\
Objective:
When a "permission" is checked, only its referenced object should be modified…

AdriGB
- 35
- 7
0
votes
1 answer
Angular polling trackBy doesn't trigger ngDestroy but the component is updated
In this example
https://stackblitz.com/edit/angular-ivy-hptdnu?file=src%2Fapp%2Fgrid%2Fgrid.component.html
without trackBy the ngOnDestroy hook is triggered and the data updated I can understand it
but in this other…

user3887366
- 2,226
- 4
- 28
- 41