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

fix($parse): correctly assign expressions who's path is undefined and that use brackets notation #8113

Closed
wants to merge 1 commit into from

Conversation

rodyhaddad
Copy link
Contributor

Closes #8039

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#8113)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@Narretz Narretz added this to the 1.3.0 milestone Jul 9, 2014
@@ -708,6 +710,7 @@ Parser.prototype = {
var key = indexFn(self, locals);
// prevent overwriting of Function.constructor which would break ensureSafeObject check
var safe = ensureSafeObject(obj(self, locals), parser.text);
if (!safe) obj.assign(self, safe = {});
return safe[key] = value;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if key is safeName first

@rodyhaddad rodyhaddad self-assigned this Jul 15, 2014
@lgalfaso
Copy link
Contributor

I am somehow torn on this PR, the main reason being that people expect that for the expression a[0], that a is an array

@rodyhaddad
Copy link
Contributor Author

The initial issue is a symptom of a too forgiving expression language.

Talking with @IgorMinar, the array scenario isn't worth handling for now.
We'll address it if someone complains with a good use case :-)

Landed as c03ad24 and 60366c8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ng-model pointing to an expression containing square brackets fail if a middle value is undefined
4 participants