Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 51faaff

Browse files
perf(ngOptions): only watch labels if a display expression is specified
#11052
1 parent 3c6a0e5 commit 51faaff

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ng/directive/ngOptions.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,14 @@ var ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {
267267

268268
Object.keys(values).forEach(function getWatchable(key) {
269269
var locals = getLocals(values[key], key);
270-
var label = displayFn(scope, locals);
271270
var selectValue = getTrackByValue(values[key], locals);
272271
watchedArray.push(selectValue);
273-
watchedArray.push(label);
272+
273+
// Only need to watch the displayFn if there is a specific label expression
274+
if (match[2]) {
275+
var label = displayFn(scope, locals);
276+
watchedArray.push(label);
277+
}
274278
});
275279
return watchedArray;
276280
}),

0 commit comments

Comments
 (0)