简体   繁体   中英

Make simple databinding with rivetsjs

can someone help me making

<div id="infoview">
          Infos <span data-text="appel:ref"></span>
</div>

The javascript:

var appel = {
    adresse: "Plateau Rue du Commerce",
    ref: "helo"
};
rivets.bind($('#infoview'), {appel: appel});

I used the last minified version of rivets.js Thanks, here the jsfiddle

There what i done, for any people having same issue (i don't think there will be)

<div id="infoview">
          Infos <span rv-text="appel.ref"></span>
</div>

And javacsript:

var appel = {
    adresse: "Plateau Rue du Commerce",
    ref: "helo"
};
rivets.bind($('#infoview'), {appel: appel});

Mixed data-text and rv-text, so the proper way is rv-text. And beware of keypath appel.ref and appel:ref, if you want to use appel:ref you need to create an adaptater

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM