Hallo!
|
if ( Array.isArray( propertyNames ) ) { |
|
|
|
cacheKey = propertyNames.join( "->" ); |
|
|
|
// Ensure cached identity function. |
|
if ( ! cache[ cacheKey ] ) { |
|
|
|
cache[ cacheKey ] = function trackByProperty<T>( index: number, item: T ) : any { |
|
|
|
var values = []; |
|
|
|
// Collect the item values that will be aggregated in the resultant |
|
// item identity |
|
for ( var propertyName of propertyNames ) { |
|
|
|
values.push( item[ propertyName ] ); |
|
|
|
} |
|
|
|
return( values.join( "->" ) ); |
|
|
|
}; |
|
|
|
} |
This part for a list of properties doesn't work correctly.
the list will be re'rendered each time if I click on refresh button with the same data. If I move the code into separate function and use directly on trackBy, then the list will be never re'rendered...
any Idea?
Outputs:
on start:

after click on refresh button:

Hallo!
JavaScript-Demos/demos/ng-for-track-by-pipe2-angular7/app/track-by-property.pipe.ts
Lines 37 to 60 in fa6730f
This part for a list of properties doesn't work correctly.
the list will be re'rendered each time if I click on refresh button with the same data. If I move the code into separate function and use directly on trackBy, then the list will be never re'rendered...
any Idea?
Outputs:
on start:

after click on refresh button:
