Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

specifying allow-clear value on a select-base #681

Closed
starf opened this issue Feb 18, 2015 · 6 comments
Closed

specifying allow-clear value on a select-base #681

starf opened this issue Feb 18, 2015 · 6 comments

Comments

@starf
Copy link

starf commented Feb 18, 2015

When using allow-clear, it changes the value to "undefined" which is not always the wanted behaviour.
Could it be possible to add something like: allow-clear-value="0" (and obviously show placeholder or nothing when model is that value)

Would it be more "correct" to refactor my code to work with undefined?
Greetings.

@dimirc
Copy link
Contributor

dimirc commented Feb 18, 2015

What other case other than allow-clear-value="0" are you having? I dont see enough use cases to justify make this changes yet

@starf
Copy link
Author

starf commented Feb 18, 2015

or an empty string. no biggie actually. thanks for considering.

@starf
Copy link
Author

starf commented Feb 19, 2015

scrap that, this is a duplicate of #302

Explanation: in 0.9.9, choosing allow-clear removes the model from the array it is in which creates all kind of issues, we need to be able to specify whether it will be 0 or an empty string or undefined or whatever.

Been dabbling inside the code but it's a level above my head.

Thanks

@starf
Copy link
Author

starf commented Feb 19, 2015

The plunkr, in the hopes this could get resolved soon :)
http://plnkr.co/edit/G3f7ox2suhUNM8e86jOb?p=preview

@starf
Copy link
Author

starf commented Feb 25, 2015

Ok, all i want to know, is the behaviour in the plunkr normal?

@user378230
Copy link
Contributor

Closing this as I believe this can be resolved by creating a custom directive to add a formatter for the ng-model which can be used to interpret the undefined value as the user sees fit.

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

3 participants