rivets
rivets copied to clipboard
Is something like this possible to bind with rivets?
var model = {
languages: [ "en", "ru" ],
items: [ {id: 1000, localized: { "en": { name: "English name" }, "ru": { name: "Russian name" }}}, ... ]
}
<div rv-each-item="items">
<div rv-each-language="languages"
<input rv-value="item[language].name" />
</div>
</div>
Should somehow interpret "language" as value of language, and not item.language, possible?
You want to use a formatter for what you're trying to achieve. Something like below would work.
Thanks tanshul, but what if I need it in a text input with two-way binding?
You can use formatters in any context. Notice the updated JSFiddle which sets the input value using rv-value.
Thanks!