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

docs(ngModel.NgModelController): Example inputs behave the same when … #13340

Closed
wants to merge 1 commit into from

Conversation

FesterCluck
Copy link

…they shouldn't.

The first input demonstrating $rollbackViewValue is meant to rollback the value, not make it blank. Code in it's current state makes both behave the same.

…they shouldn't.

The first input demonstrating $rollbackViewValue is meant to rollback the value, not make it blank. Code in it's current state makes both behave the same.
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@FesterCluck
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

@Narretz
Copy link
Contributor

Narretz commented Nov 19, 2015

Hmm. If you remove $scope.myValue = ''; from resetWithCancel, nothing happens to both inputs. That can't be right either. I wonder if something else with the example is broken.

@FesterCluck
Copy link
Author

The core feature we're aiming at here is when hitting escape after changing
the value, it should reset to the previous value (from the model).

Perhaps a blank initial value is a bad use case. What the demo aims to
demonstrate is that the first function restores the model value to the view
value, while the latter must overwrite the model value. Test it giving
$scope.myValue = 'whatever'; and it will make much more sense.

If it does, I'll update my pull request accordingly.

On Nov 19, 2015 7:55 AM, "Martin Staffa" [email protected] wrote:

Hmm. If you remove $scope.myValue = ''; from resetWithCancel, nothing
happens to both inputs. That can't be right either. I wonder if something
else with the example is broken.


Reply to this email directly or view it on GitHub
#13340 (comment).

@Narretz Narretz self-assigned this Nov 26, 2015
@Narretz
Copy link
Contributor

Narretz commented Dec 3, 2015

On further investigation: the use case for rollbackViewValue is actually quite obsolete. If by pressing ESC you set assign a value to the model like "whatever", and then blur the input, it will not set it to the last thing you've entered. Somewhere along the line, it must have been built in that this handled correctly. I will change this example to simply show that $rollbackViewValue resets the view to the last commited value. Thanks for bringing attention to this.

@Narretz
Copy link
Contributor

Narretz commented Dec 3, 2015

On even further investigation, the described problem does happen, but only when you are trying to set the model to a value that it is already set to, like ''. The thing is that the description of the example is not set up to elicit this behavior.

Narretz added a commit that referenced this pull request Dec 3, 2015
…mple

The example has been expanded to make it easier to provoke the
behavior that the description is talking about (rollbackViewValue
and programmatic model updates)

Related #13340
Narretz added a commit that referenced this pull request Dec 3, 2015
…mple

The example has been expanded to make it easier to provoke the
behavior that the description is talking about (rollbackViewValue
and programmatic model updates)

Related #13340
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.

3 participants