Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Setting an empty string instead of null or empty object when editable is false #3176

Closed
rpdmiranda opened this issue Jan 10, 2015 · 3 comments

Comments

@rpdmiranda
Copy link

When the user clears the input field, the parser returns an empty string instead of null. This may cause problems when the controller expects the ng-model to be an object.

I fixed this changing the line 3719, inside the parser function:

if (!inputValue) {
            // Reset in case user had typed something previously.
            // An empty string is not always the best value to return
            modelCtrl.$setValidity('editable', true);
            return null;
@antoinepairet
Copy link

Thx. It would be great if you could send a PR with appropriate tests. Rgds

@rpdmiranda
Copy link
Author

I have just made a plunker to show this issue at http://plnkr.co/edit/dDTdi7

@wesleycho wesleycho added this to the 0.13.3 (Performance) milestone Aug 2, 2015
@wesleycho wesleycho removed the PRs plz! label Aug 2, 2015
@mirabilos
Copy link

I’d rather have it the other way, returning an empty string always (if not touched, or cleared later)…

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

No branches or pull requests

4 participants