Skip to content

Commit

Permalink
fix($parse): assign returns the new value
Browse files Browse the repository at this point in the history
The `.assign` function returns the new value.
The version with csp enabled already has this behavior.

Closes angular#12675
  • Loading branch information
lgalfaso committed Aug 30, 2015
1 parent 1d18e60 commit 77a637e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ ASTCompiler.prototype = {
this.state.computing = 'assign';
var result = this.nextId();
this.recurse(assignable, result);
this.return_('v');
extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');
}
var toWatch = getInputs(ast.body);
Expand Down
2 changes: 1 addition & 1 deletion test/ng/parseSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2793,7 +2793,7 @@ describe('parser', function() {
var fn = $parse('a');
expect(fn.assign).toBeTruthy();
var scope = {};
fn.assign(scope, 123);
expect(fn.assign(scope, 123)).toBe(123);
expect(scope).toEqual({a:123});
}));

Expand Down

0 comments on commit 77a637e

Please sign in to comment.