angular-dynamic-number icon indicating copy to clipboard operation
angular-dynamic-number copied to clipboard

Empty field handled as NULL instead of ZERO

Open brunobenvenuti opened this issue 9 years ago • 4 comments

Currently, if you type a number and then erase it, the component handles it as ZERO instead of NULL (or maybe unassigned...)

The same happens if you type only "-". It accepts the minus signal, but internally handles it as ZERO.

I would suggest handling both cases as null value.

brunobenvenuti avatar Jan 27 '17 19:01 brunobenvenuti

It is because this directive returns ONLY numbers. It is by design (in previous version 1.x.x there was discussion about it) Each value before return is passed to this function:

  function prepareResponse(value) {
    return Number(value);
  }

uhlryk avatar Jan 28 '17 12:01 uhlryk

Thanks for your reply!

I've opened this issue because I have a CRUD page that makes use of your directive and was not able to identify when the user erases the number... I'd like to store it as null, but I could not say if the user had typed zero or just erased the field.

Do you suggest any way to distinguish these situations?

Thanks a lot.

brunobenvenuti avatar Jan 29 '17 13:01 brunobenvenuti

Sorry for my late responses. Im unfortunately very busy. I will again consider your case. If so during weekend I will fix it.

uhlryk avatar Feb 17 '17 20:02 uhlryk

Hello!

Any news on this issue?

Thanks in advance!

brunobenvenuti avatar Apr 07 '17 22:04 brunobenvenuti