Skip to content

New Property 'Blank'#51

Open
gjeanmart wants to merge 2 commits intouhlryk:masterfrom
gjeanmart:master
Open

New Property 'Blank'#51
gjeanmart wants to merge 2 commits intouhlryk:masterfrom
gjeanmart:master

Conversation

@gjeanmart
Copy link
Copy Markdown
Collaborator

Added a new property blank that allows to set a default value if the value in the ng-model is null, undefined or empty string. Meaningful to display 'N/A' or '-' instead of 0.
Default value is '0'

Gjeanmart added 2 commits March 9, 2017 14:29
…e value in the ng-model is null, undefined or empty string. Meaningful to display 'N/A' or '-' instead of 0.
…e value in the ng-model is null, undefined or empty string. Meaningful to display 'N/A' or '-' instead of 0.
@uhlryk
Copy link
Copy Markdown
Owner

uhlryk commented Mar 12, 2017

Thank you very much for you work. It is great. It works. But Im not convinced that this is good way to solve problem.
Because your solution display as a value which means that for user it can display 'N/A' and then he need to push backspace 3 times to clear it.

Please look on this pull request #52 (it is available on branch return-null). For wrong values it will return null in model and empty string for input field. When input field get empty string it will show value from placeholder. And I think that this solves the problem.
Because it will show placeholder more often. You can change message in placeholder. For example you can set 'N/A' but if user click on it it will disappear which is in my opinion better user experience.

@gjeanmart
Copy link
Copy Markdown
Collaborator Author

gjeanmart commented Mar 12, 2017

Hi, thanks for the review.

My though was to especially use this property as a filter, for example in a table to display a null value as '-' or 'N/A'.

In the example below:
image

  • Percentage input field is initialized to 0 using numBlank="0"
  • Units text field is rendered as '-' if the value is null using numBlank="-"

However, I agree the behavior can be a little bit weird for an input if numBlank is different than a number or an empty string. But I guess, it's parameterization. Would be the same if the developer puts '@' as a decimal separator.

Regards,

@uhlryk
Copy link
Copy Markdown
Owner

uhlryk commented Jun 6, 2017

Hey
I saw your github profile and it looks like you are very active and have some fresh ideas for this module. If you like I can give you permission for write to this repo if you want.

@gjeanmart
Copy link
Copy Markdown
Collaborator Author

Thanks for the proposition. I can indeed spare some time to help you maintaining this module.
Regards,

@uhlryk
Copy link
Copy Markdown
Owner

uhlryk commented Jun 8, 2017

Thanks,
I don't have any active angular project (all my current projects are based on react.js). I know that many other still may need it therefore I would like still support it, I will not abandon but Im not interested in improving it. I hope that you or someone else who still use it will make it better. I send you invitation.

The main problem with this module is that it at the beginning was designed for smaller number of features. And it started scaling up, but code quality is now terrible. It is great candidate for rewriting. But Im sure that it is not worth this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants