My model “content.id” contains a string, e,g “123”:
{{view Em.TextArea idBinding="content.id"}}
Instead of just setting the id of this view to “123”, I’d like it to be “message-123”, basically customizing the string being used. Sadly, Ember does not allow bindings to be functions, which would solve my problem (I could define such a function on the controller).
What’s the best way to achieve this?
You could define a computed property in the controller (or elsewhere):
The controller
The view
The template (where content is a
String, here)And the JSFiddle is here.
EDIT
The router, after started, automatically render the
ApplicationView, or its template when there is noApplicationViewdefined. If you want more detail, I suggest you to read the Ember guide: Understanding the Ember.js Router: A Primer.And
{{editedContent}}directly get the controllereditedContentproperty, because the default view context is its controller, as you can read in Ember Blog – 1.0 Prerelease: