Permalink
Browse files

perf(ngOptions): only watch labels if a display expression is specified

  • Loading branch information...
petebacondarwin committed Feb 13, 2015
1 parent 3c6a0e5 commit 51faaffdbcc734c55d52ff6c42b386d5c90207ea
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/ng/directive/ngOptions.js
@@ -267,10 +267,14 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
Object.keys(values).forEach(function getWatchable(key) {
var locals = getLocals(values[key], key);
var label = displayFn(scope, locals);
var selectValue = getTrackByValue(values[key], locals);
watchedArray.push(selectValue);
watchedArray.push(label);
// Only need to watch the displayFn if there is a specific label expression
if (match[2]) {
var label = displayFn(scope, locals);
watchedArray.push(label);
}
});
return watchedArray;
}),

1 comment on commit 51faaff

@petebacondarwin

This comment has been minimized.

Member

petebacondarwin commented on 51faaff Feb 18, 2015

Closes #11052

Please sign in to comment.