Input helper valueBinding is deprecated - what'

2019-05-18 06:31发布

I've got a few text-input helper like this

{{input type="text" valueBinding="name" focus-out="focusOutName"}}

I just upgraded Ember to 1.11.0 and now get this deprecation warning:

DEPRECATION: You're attempting to render a view by passing valueBinding to a view helper, but this syntax is deprecated. You should use value=someValue instead.

However when using value it is not bound in the controller and value simply sets the text to whatever value.

How do I correctly bind it?

1条回答
聊天终结者
2楼-- · 2019-05-18 06:59

You should just have to change:

{{input type="text" valueBinding="name" focus-out="focusOutName"}}

to:

{{input type="text" value=name focus-out="focusOutName"}}

or even better (don't need the type="text", it's automatic):

{{input value=model.name focus-out="focusOutName"}}

then next to it you can display the value, and see it change when you change the input (so you can test for yourself that the bindings are set up already):

{{input value=model.name focus-out="focusOutName"}}
{{model.name}}
查看更多
登录 后发表回答