简体   繁体   中英

how to access json response object using rivets.js?

can any one help me out as I'm new to rivets.js. I have a issue with accessing JSON response in my html page. I'm able to access till 'subTotal' key with account.subTotal, but not able to access currency (inner keys) etc. Below is the JSON response I have:

[
{
    "subTotal": [
        {
            "currency": "dollar",
            "balance": "979,18"
        }]
    ,
    "productList": [
        {
            "acctno": "123456789",
            "Name": "abc",

        }
    ]
},
{
    "subTotal": [
        {
            "currency": "dollar",
            "balance": "979,18"
        }]
    ,
    "productList": [
        {
            "acctno": "123456789",
            "Name": "abc",

        }
    ]
},
{
    "subTotal": [
        {
            "currency": "dollar",
            "balance": "979,18"
        }]
    ,
    "productList": [
        {
            "acctno": "123456789",
            "Name": "abc",

        }
    ]
}

]

Below is how I'm appending in HTML template:

<ul>
<li data-each-account="model">
    <a href="#">
    <strong data-text="account.subTotal.currency"></strong><br/>
    </a>
    </li>
</ul>                       

Thanks in advance !

data-text="account.subTotal || attr currency">

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