Thanks to visit codestin.com
Credit goes to github.com

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

fix($parse): Handle the empty string as an object key #9914

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ Parser.prototype = {
break;
}
var token = this.expect();
keys.push(token.string || token.text);
keys.push(isDefined(token.string) ? token.string : token.text);
this.consume(':');
var value = this.expression();
valueFns.push(value);
Expand Down
1 change: 1 addition & 0 deletions test/ng/parseSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ describe('parser', function() {
expect(toJson(scope.$eval("{a:'b',}"))).toEqual('{"a":"b"}');
expect(toJson(scope.$eval("{'a':'b',}"))).toEqual('{"a":"b"}');
expect(toJson(scope.$eval("{\"a\":'b',}"))).toEqual('{"a":"b"}');
expect(toJson(scope.$eval('{"":"b",}'))).toEqual('{"":"b"}');
});

it('should evaluate object access', function() {
Expand Down