-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default "Please select..." style option for select fields. #55
Comments
I'll see if I can find time to make this example eventually. But basically here's what I recommend:
I find this is a much easier approach to figuring out how to do things with angular-formly. |
Thanks for the response. That's kind of what I did though and it didn't work :( I added an option like this to the beginning of my options array for the select field : { (I have the valueProp and the labelProp set as well). But this caused the odd issue with the extra option item getting added. Thanks |
Sorry I don't have time to help right now, but here's the one I use at work that allows for this functionality. Maybe it'll be helpful to you: https://gist.github.com/kentcdodds/bacc2658bfbcbaa135f1 (Note, I've verified that this is not possible with formly bootstrap currently, if you'd like to make a PR I'd love it). |
No worries - thanks for the code. I'm using formly bootstrap, so it's just good to know it's not just me missing something really obvious :) I'll take a look and see if I can figure out how to get it working in bootstrap. If I do I'll feed it back. |
Forgot to also add - I really love Formly! This feels like the natural way that Angular should actually be forms :) |
I would like an example that demonstrates:
How to set a default option for select fields that doesn't pass validation - basically an option with the value set to an empty string/null etc. I think this is a regular feature where the user is prompted to "please select..." but I can't find any way of doing it.
I've tried to figure this out, but seem to be getting nowhere. If it makes any difference I'm loading the values from an ajax call and filling them. When the first option has an empty string value it adds an extra option before it like this:
The text was updated successfully, but these errors were encountered: