From 3cea386b2c26abffb0d2acfd9584203126f7579c Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Fri, 13 Feb 2015 11:09:32 +0000 Subject: [PATCH] perf(ngOptions): only watch labels if a display expression is specified --- src/ng/directive/ngOptions.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ng/directive/ngOptions.js b/src/ng/directive/ngOptions.js index f6ec5f227c0b..55b8d42faa5d 100644 --- a/src/ng/directive/ngOptions.js +++ b/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; }),