angular-xeditable icon indicating copy to clipboard operation
angular-xeditable copied to clipboard

Null value edited then deleted results in empty string

Open AndrewIsh opened this issue 9 years ago • 5 comments

I have a model property with a null value, I then do the following:

  • edit it, giving it a value
  • save (i.e. click the 'tick' button)

Then I:

  • edit it, removing the value
  • save (i.e. click the 'tick' button)

The model value is not returned to null, instead it is an empty string. I would expect it to be null.

AndrewIsh avatar Apr 13 '15 15:04 AndrewIsh

Worth noting that this problem seems limited to text inputs, number inputs are set to null when empty

AndrewIsh avatar Apr 13 '15 15:04 AndrewIsh

i think you can handle it by onbeforesave event.

if(empty == data){
data = null;
}

zhendong590 avatar Apr 14 '15 04:04 zhendong590

Is this still an issue?

ckosloski avatar Nov 16 '16 02:11 ckosloski

@AndrewIsh is this still an issue?

ckosloski avatar Aug 25 '17 21:08 ckosloski

Apologies for the delay in replying. The fix that @zhendong590 suggests obviously works, I guess it's now more a question of whether reverting to an empty string rather than null is desirable behaviour for angular-xeditable to be doing? My personal feeling is that reverting to null would be proper behaviour.

AndrewIsh avatar Aug 30 '17 08:08 AndrewIsh