Repository navigation
Conversation
|
Thanks for the PR! Before we can merge we a few things:
Can you work on improving this? If you need help with setting up a dev environment, check https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md or ask here |
|
Will do! Thanks for the instructions, I'll add docs and a test, then squash all the commits together. I'm a little confused about commit messages - I thought I'd included the issue. Should I use "closes" rather than "references"? Also, the original issue was opened as a bug, has it been reassessed as a feature? (No disagreement if it is! I'm just a newbie to the project and I want to make sure I understand) |
|
"Closes" in the commit message closes the issue when your commit is merged into master. Which is what we want. :) I say it's a feature, because it's not a bug, it's just something that's missing. Or did this ever work before in some way? |
|
That all makes sense to me. I don't believe this has worked before, but I just searched for the "PRs Plz" tag and grabbed one I could make sense of. |
6284f68 to
a81ace4
Compare
|
Cool, it's always good to see new contributors. These formal issues (commit message, multiple commits) can be handled when code & docs are ready, they are not blocking. |
|
Thanks for your help. When correcting a previously made PR, should I add a comment to that effect? |
There was a problem hiding this comment.
Angular expressions are only a subset of Javascript.
|
Yes, you should write a commit. Because subscribers don't get notifications for code pushes. I wonder if the feature is "good enough", because it only works if the option is explicitly selected. I would expect it to work also on load, before any interaction has happened. |
a81ace4 to
490a3cb
Compare
|
Okay, I believe I addressed your comments. Thanks for your time in giving those! |
allow an optional ng-empty-value attribute on select elements using ng-options. any option whose value is an empty string will be replaced with the given empty-value. Closes: angular#13334
490a3cb to
b6fb9c3
Compare
|
Good stuff. I have to think about setting the empty option on load. It's probably not necessary to do that. |
There was a problem hiding this comment.
You should use the createSingleSelect fn here, to make it consistent with other tests
There was a problem hiding this comment.
If I use createSingleSelect, how do I give it an ng-empty-value attribute? I was reluctant to change such a heavily used function for just the one test.
There was a problem hiding this comment.
True, didn't think about that. You should be able to use createSelect:
createSelect({
'ng-model':'selected',
'ng-empty-value': 'someVar',
'ng-options':'value.name for value in values'
}, true);
|
Sorry, I keep finding things. ;) |
|
Updated for most of your notes, with the exception of the one I replied about in your line notes. Thanks for your time in looking at these! |
|
So... is this PR dead? I was trying to use this feature until I realized it was never actually merged. 😞 |
|
TBH, now that |
|
I agree that this is not needed in core. Although I don't see how ngValue + select changes the assumptions here - both regular and ngOptions select will set the model to In #1780, there are 2 workarounds for this problem, and I've added a 3rd one that implements emptyValue, but doesn't rely on private API. |
Reference: #13334
This would allow an additional attribute on ng-options to provide a default value for options that lack values.