Skip to content

Commit 2cc669a

Browse files
committed
Add possibility to find value according to a property of the model
I needed that feature to preload existing model objects that are not in the source list. The comparison is made upon the property setted via the "track by" of the repeater.
1 parent 36ee169 commit 2cc669a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/select.js

+7
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,13 @@
606606
for (var p = list.length - 1; p >= 0; p--) {
607607
locals[$select.parserResult.itemName] = list[p];
608608
result = $select.parserResult.modelMapper(scope, locals);
609+
if($select.parserResult.trackByExp){
610+
var matches = /\.(.+)/.exec($select.parserResult.trackByExp);
611+
if(matches.length>0 && result[matches[1]] == value[matches[1]]){
612+
resultMultiple.unshift(list[p]);
613+
return true;
614+
}
615+
}
609616
if (result == value){
610617
resultMultiple.unshift(list[p]);
611618
return true;

0 commit comments

Comments
 (0)