bootstrap
bootstrap copied to clipboard
Setting an empty string instead of null or empty object when editable is false
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;
Thx. It would be great if you could send a PR with appropriate tests. Rgds
I have just made a plunker to show this issue at http://plnkr.co/edit/dDTdi7
I’d rather have it the other way, returning an empty string always (if not touched, or cleared later)…