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

Commit 77a637e

Browse files
committed
fix($parse): assign returns the new value
The `.assign` function returns the new value. The version with csp enabled already has this behavior. Closes #12675
1 parent 1d18e60 commit 77a637e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/ng/parse.js

+1
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ ASTCompiler.prototype = {
774774
this.state.computing = 'assign';
775775
var result = this.nextId();
776776
this.recurse(assignable, result);
777+
this.return_('v');
777778
extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');
778779
}
779780
var toWatch = getInputs(ast.body);

test/ng/parseSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,7 @@ describe('parser', function() {
27932793
var fn = $parse('a');
27942794
expect(fn.assign).toBeTruthy();
27952795
var scope = {};
2796-
fn.assign(scope, 123);
2796+
expect(fn.assign(scope, 123)).toBe(123);
27972797
expect(scope).toEqual({a:123});
27982798
}));
27992799

0 commit comments

Comments
 (0)