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

Commit b6a37d1

Browse files
committedOct 9, 2013
revert: fix($parse): handle promises returned from parsed function calls
This reverts commit 3a65822. The change cased regressions in third party components that require promises from getter functions not to be unwrapped. Since we have deprecated the promise unwrapping support in $parse it doesn't make much sense to fix this issue and deal with regressions in third party code. Closes #4158
1 parent 5dc35b5 commit b6a37d1

File tree

2 files changed

+0
-22
lines changed

2 files changed

+0
-22
lines changed
 

‎src/ng/parse.js

-10
Original file line numberDiff line numberDiff line change
@@ -761,16 +761,6 @@ Parser.prototype = {
761761
? fnPtr.apply(context, args)
762762
: fnPtr(args[0], args[1], args[2], args[3], args[4]);
763763

764-
// Check for promise
765-
if (v && v.then && parser.options.unwrapPromises) {
766-
var p = v;
767-
if (!('$$v' in v)) {
768-
p.$$v = undefined;
769-
p.then(function(val) { p.$$v = val; });
770-
}
771-
v = v.$$v;
772-
}
773-
774764
return ensureSafeObject(v, parser.text);
775765
};
776766
},

‎test/ng/parseSpec.js

-12
Original file line numberDiff line numberDiff line change
@@ -1129,18 +1129,6 @@ describe('parser', function() {
11291129
expect(scope.$eval('greeting')).toBe(undefined);
11301130
});
11311131

1132-
it('should evaluate a function call returning a promise and eventually get its return value', function() {
1133-
scope.greetingFn = function() { return promise; };
1134-
expect(scope.$eval('greetingFn()')).toBe(undefined);
1135-
1136-
scope.$digest();
1137-
expect(scope.$eval('greetingFn()')).toBe(undefined);
1138-
1139-
deferred.resolve('hello!');
1140-
expect(scope.$eval('greetingFn()')).toBe(undefined);
1141-
scope.$digest();
1142-
expect(scope.$eval('greetingFn()')).toBe('hello!');
1143-
});
11441132

11451133
describe('assignment into promises', function() {
11461134
// This behavior is analogous to assignments to non-promise values

0 commit comments

Comments
 (0)
This repository has been archived.