Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Commit

Permalink
fix(track by): fix "track by"
Browse files Browse the repository at this point in the history
Eenhance regex functions to avoid failures with the "track by" feature

Fixes #806 and #665
  • Loading branch information
aaronroberson committed Feb 18, 2016
2 parents b1c4fdc + 457be42 commit 6c52e41
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/uiSelectMultipleDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ uis.directive('uiSelectMultiple', ['uiSelectMinErr','$timeout', function(uiSelec
locals[$select.parserResult.itemName] = list[p];
result = $select.parserResult.modelMapper(scope, locals);
if($select.parserResult.trackByExp){
var matches = /\.(.+)/.exec($select.parserResult.trackByExp);
if(matches.length>0 && result[matches[1]] == value[matches[1]]){
resultMultiple.unshift(list[p]);
return true;
var propsItemNameMatches = /(\w*)\./.exec($select.parserResult.trackByExp);
var matches = /\.([^\s]+)/.exec($select.parserResult.trackByExp);
if(propsItemNameMatches.length > 0 && propsItemNameMatches[1] == $select.parserResult.itemName){
if(matches.length>0 && result[matches[1]] == value[matches[1]]){
resultMultiple.unshift(list[p]);
return true;
}
}
}
if (angular.equals(result,value)){
Expand Down

0 comments on commit 6c52e41

Please sign in to comment.