Skip to content

Commit

Permalink
revert: fix($parse): handle promises returned from parsed function calls
Browse files Browse the repository at this point in the history
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 angular#4158
  • Loading branch information
IgorMinar committed Oct 9, 2013
1 parent 117f4dd commit 4c112f5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
10 changes: 0 additions & 10 deletions src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,16 +761,6 @@ Parser.prototype = {
? fnPtr.apply(context, args)
: fnPtr(args[0], args[1], args[2], args[3], args[4]);

// Check for promise
if (v && v.then && parser.options.unwrapPromises) {
var p = v;
if (!('$$v' in v)) {
p.$$v = undefined;
p.then(function(val) { p.$$v = val; });
}
v = v.$$v;
}

return ensureSafeObject(v, parser.text);
};
},
Expand Down
12 changes: 0 additions & 12 deletions test/ng/parseSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,18 +1129,6 @@ describe('parser', function() {
expect(scope.$eval('greeting')).toBe(undefined);
});

it('should evaluate a function call returning a promise and eventually get its return value', function() {
scope.greetingFn = function() { return promise; };
expect(scope.$eval('greetingFn()')).toBe(undefined);

scope.$digest();
expect(scope.$eval('greetingFn()')).toBe(undefined);

deferred.resolve('hello!');
expect(scope.$eval('greetingFn()')).toBe(undefined);
scope.$digest();
expect(scope.$eval('greetingFn()')).toBe('hello!');
});

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

0 comments on commit 4c112f5

Please sign in to comment.