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

fix($parse): one-time binding for literal expressions works as expected #8209

Closed
wants to merge 1 commit into from

Conversation

rodyhaddad
Copy link
Contributor

Meaning the watcher is only removed when all the properties of the object, or
all the elements of the array, are defined.

Closes #7663

@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 (#8209)

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
Copy link
Contributor

Narretz commented Jul 15, 2014

👍 😺

@lgalfaso
Copy link
Contributor

I think I understand why there is a need for this change, but I see two minor nits that need to be discussed
1/ It is arbitrary that the check is only on one level, e.g the expression '::[{abc: abc}]'
2/ The expressions '::[abc: abc]' and '::true ? [abc: abc] : false' work differently

@Narretz
Copy link
Contributor

Narretz commented Aug 1, 2014

@rodyhaddad Do you know what the status of this is?

Regarding point 1, I think since this is mainly mimicking bindonce, it's simply a decision made by convention to only support one level. More complex bindings are proably very rare.

Meaning the watcher is only removed when all the properties of the object, or
all the elements of the array, are defined.
@rodyhaddad rodyhaddad closed this in c024f28 Aug 2, 2014
@rodyhaddad
Copy link
Contributor Author

Mentioning this to Igor, this change is more for ng-style and ng-class than anything else.
So supporting nested literal expressions doesn't make much sense. Specially since it would require a big rewrite of $parse.

If someone has a complex expression and still wants to make use of one-time binding for objects/array, they can always wait till everything is defined before setting a variable on the $scope

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.

Clarification about lazy one-time binding for object literals
4 participants