rivets icon indicating copy to clipboard operation
rivets copied to clipboard

Is something like this possible to bind with rivets?

Open superware opened this issue 9 years ago • 4 comments

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?

superware avatar Mar 18 '16 14:03 superware

You want to use a formatter for what you're trying to achieve. Something like below would work.

https://jsfiddle.net/9cmxmbyj/

anshul-kai avatar May 10 '16 23:05 anshul-kai

Thanks tanshul, but what if I need it in a text input with two-way binding?

superware avatar May 11 '16 07:05 superware

You can use formatters in any context. Notice the updated JSFiddle which sets the input value using rv-value.

https://jsfiddle.net/9cmxmbyj/1/

anshul-kai avatar May 11 '16 13:05 anshul-kai

Thanks!

superware avatar May 12 '16 20:05 superware