feat(ngFor): add custom trackBy function support

Make it possible to track items in iterables in custom ways (e.g. by ID or index), rather than simply by identity.

Closes #6779
This commit is contained in:
Kara Erickson
2016-02-01 18:31:26 -08:00
committed by Kara
parent cfef76f683
commit cee2318110
10 changed files with 192 additions and 62 deletions

View File

@ -249,7 +249,7 @@ const CORE = [
'IterableDiffer.diff(object:any):any',
'IterableDiffer.onDestroy():any',
'IterableDifferFactory',
'IterableDifferFactory.create(cdRef:ChangeDetectorRef):IterableDiffer',
'IterableDifferFactory.create(cdRef:ChangeDetectorRef, trackByFn:TrackByFn):IterableDiffer',
'IterableDifferFactory.supports(objects:any):boolean',
'IterableDiffers',
'IterableDiffers.constructor(factories:IterableDifferFactory[])',
@ -441,6 +441,7 @@ const CORE = [
'TestabilityRegistry.getAllTestabilities():Testability[]',
'TestabilityRegistry.getTestability(elem:any):Testability',
'TestabilityRegistry.registerApplication(token:any, testability:Testability):any',
'TrackByFn',
'TypeDecorator',
'TypeDecorator.Class(obj:ClassDefinition):ConcreteType',
'TypeDecorator.annotations:any[]',
@ -696,6 +697,7 @@ const COMMON = [
'NgFor.ngDoCheck():any',
'NgFor.ngForOf=(value:any)',
'NgFor.ngForTemplate=(value:TemplateRef)',
'NgFor.ngForTrackBy=(value:TrackByFn)',
'NgForm',
'NgForm.addControl(dir:NgControl):void',
'NgForm.addControlGroup(dir:NgControlGroup):void',