diff --git a/src/ng/parse.js b/src/ng/parse.js index 7aa379edf5c3..9f362f990899 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -1977,7 +1977,11 @@ function $ParseProvider() { } else if (!interceptorFn.$stateful) { // Treat interceptor like filters - assume non-stateful by default and use the inputsWatchDelegate fn.$$watchDelegate = inputsWatchDelegate; - fn.inputs = (parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression]).map(function(e) { + fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression]; + } + + if (fn.inputs) { + fn.inputs = fn.inputs.map(function(e) { // Remove the isPure flag of inputs when it is not absolute because they are now wrapped in a // potentially non-pure interceptor function. if (e.isPure === PURITY_RELATIVE) { diff --git a/test/ng/directive/ngClassSpec.js b/test/ng/directive/ngClassSpec.js index 1c08a1c4133c..0180d67a6aa4 100644 --- a/test/ng/directive/ngClassSpec.js +++ b/test/ng/directive/ngClassSpec.js @@ -532,6 +532,20 @@ describe('ngClass', function() { }) ); + it('should support a one-time mixed literal-array/object variable', inject(function($rootScope, $compile) { + element = $compile('
')($rootScope); + + $rootScope.classVar1 = {orange: true}; + $rootScope.$digest(); + expect(element).toHaveClass('orange'); + + $rootScope.classVar1.orange = false; + $rootScope.$digest(); + + expect(element).not.toHaveClass('orange'); + }) + ); + it('should do value stabilization as expected when one-time binding', inject(function($rootScope, $compile) {