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
Number attributes don't convert values properly when used with input helpers #11209
Comments
This is the browser behavior and not one that Ember is adding to the mix. We are calling See this plain HTML + JS demo. If you are asking why Ember Data does not automatically convert the values back into a number for you when the attribute is set, then take a look at emberjs/data#1854 which attempted to add this auto-conversion when the attribute was set. The last comment by @igorT is almost certain still true:
|
@rwjblue ok, so what is the recommended practice in my case? Add a computed property that forces the value to an integer? I'm just trying to understand the Ember way of accomplishing this... |
@rwjblue I admit, I'm pretty stupid, but I just can't figure out a simple way to set an attribute to an integer using an |
I'm totally +1 on that one. The current behavior doesn't make sense.
|
@vmalloc Here's my quick hacky workaround:
then set In this case, I'm in a component, so also need to set initial value of ordinal on |
This might work a little better:
Really, though, we should be able to do this:
|
@michaeljbishop at that level, I think you'd just make a |
That would work, but I find it a little distasteful because for any type of value that you wanted to transform, you'd have to make a new special class for it. Adding support for a Cocoa bindings does exactly this and it works great! |
@michaeljbishop indeed, reminds me of Flex mxml! You should make an ember addon. |
Just got bit by this. In my case I was relying on the model's Thought I'd mention it here in case someone else runs into the issue. (my input is of type number) |
In the example here: http://emberjs.jsbin.com/yiqogukoqe/2/edit, a model containing a numeric field has the field change to a string once edited from an input helper. Is this the expected behavior? If it is, I couldn't find any place in the guides discouraging this usage pattern, and in any case it is unintuitive and misleading IMO
The text was updated successfully, but these errors were encountered: