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

ngStyle one-time binding regression #11403

Closed
@Narretz

Description

@Narretz

There's a regression in ngStyle that breaks lazy one-time binding (when a property value is initially undefined), caused by 4c8d8ad

Example: http://jsbin.com/tuyetahaxi/2/edit - change the version to 1.3.9, and the background-color will not be applied.

The cause for this break is that $watchCollection passes its own changeDetector function to $watch, which does not return the actual changed values, but only a changeDetected counter. However, $parse has a special path for one-time bound object literals, where it unwatches only when all object properties / array elements are defined (see c024f28). With watchCollection, the binding watch is now removed instantly as the value that is passed to $watch is not the actual object / array but the changeDetected count from $watchCollection.
I worked around this by returning the actual newValue / oldValue from inside $watchCollection's changeDetected. I'll have to test if this breaks anything, though.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions