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

fix(input): re-evaluate value if min/max changed #4788

Closed
wants to merge 1 commit into from

Conversation

quazzie
Copy link
Contributor

@quazzie quazzie commented Nov 5, 2013

Value was not re-evaluated when min/max changed.


if (attr.min || attr.max) {
scope.$watch(
function() { return attr.min + '' + attr.max; },
Copy link
Contributor

Choose a reason for hiding this comment

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

This optimisation could fail if max and min changed at the same time in such a way that max+''+min stayed the same:

22 + '' + 23 == '2223'
2 + '' + 223 == '2223'

Admittedly, this is a highly unusual and contrived case but the performance improvement is not going to be so great (if at all) to warrant it.

@petebacondarwin
Copy link
Contributor

Given the optimization comment above and that $observe is optimized not to use watches in many cases, it is better to go with #4797

@quazzie
Copy link
Contributor Author

quazzie commented Nov 12, 2013

Agreed.

@quazzie quazzie deleted the input-min-max branch November 12, 2013 11:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants