Skip to content
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

select element sends html option value not ng-model ng-options value #95

Open
rockrep opened this issue Jan 31, 2014 · 3 comments
Open

Comments

@rockrep
Copy link
Contributor

rockrep commented Jan 31, 2014

When using a select element like

select[name='category_id' ng-model='category' ng-options='c.id as c.name for c in categories']

where e.g. categories is

[{id: 12, name: 'fred'}, {id: 65, name: 'wilma'}]

The form when submitted with 'fred' selected, will submit '0' for category_id (the html option value) and not '12' the actual id of the fred category.

When posting the same form using $http.post(url, $scope.category), the category_id param will match the c.id, in this case 12.

@rockrep
Copy link
Contributor Author

rockrep commented Feb 6, 2014

FWIW, I can work around this using upload-options-convert-hidden, but it would be nice to handle selects without having to resort to that

@twilson63
Copy link
Owner

@rockrep, I am open to suggestions on how to resolve?

I wonder if we shouldn't just convert the component to XHR2 at this point, which should resolve this issue. Other Thoughts?

@rockrep
Copy link
Contributor Author

rockrep commented Feb 9, 2014

@twilson63, I agree, moving to XHR2 would make sense, at least for my use case. Are there concerns about non-HTML5 compatible browsers and using your module if converted to XHR2?

In the interim, maybe updating the readme for this workaround might be useful. I submitted a PR for this #98 if that's helpful

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

No branches or pull requests

2 participants