Reputation: 3983
I am binding fields with name
, value
attributes. but it is not comfortable.
input(name='user[name]', value='#{user.name}')
I want data-binding similar to knockout.js but without loading javascript in the client (traditional mobile devices). Something like the following code:
input(databind='username[value]')
Upvotes: 4
Views: 2529
Reputation: 1892
A big part of the power of knockout.js is "two way binding", detecting changes and events on DOM elements and reflecting them in the Model. This part is not possible without loading javascript.
So I assume you are asking about some form of one way binding when generating html to send to the client.
This makes me wonder what benefits you seek. Is it simply a preference for a different style of coding?
Knockout.js's data binding is presented as an extensible set of 'bindings' each tailored to a specific purpose, to make a specific range of use scenarios convenient. knockout's foreach, or repeat bindings can be convenient for generating lists or tables, for example. To me, knockout's greatest strength is the ease of creating new bindings to suit your specific needs.
For what it's worth here are some ideas...in no particular order.
Probably the best thing to do is to be more specific about the benefits you want. That might inspire some better responses here.
Upvotes: 2