javascript - Using a variable in jQuery template with dynamic values -
javascript - Using a variable in jQuery template with dynamic values -
i using jquery template plugin (jquery.tmpl.min.js - v 1.0.0pre). sample response object looks this:
{ "statuscode": "success", "responsemessage": null, "response": [ { "id": 92, "messageread": false, "importance": null, "message": { "id": 86, "createddate": 1414393557000, "messagetype": "testtype", "subject": "test sub", "message": "test item", "fromorg": 3, "accesscode": 2, "fromuserid": 1, "users": null, "read": false, "fromorganizationname": null, "messageattachment": [ { "id": 5, "createddate": 1414393816000, "name": "readme" } ] } } ] } in template, while iterating on messageattachment array, need access fromorg within {{each messageattachment}} loop.
{{if message.messageattachment.length > 0 }} {{each message.messageattachment}} \${name} <br/> ---- need value of fromorg here--- {{/each}} {{/if}} how can accomplish this? take on declare variable before looping messageattachment array , utilize variable within loop. referred so:
can declare local/temp variables within jquery template?
i tried utilize ${( $data.localvariable = 'something' ),''} unable assign runtime value instead of sometthing.
also, of there other way, please share. pointers appreciated. tia.
as suggested @adeneo, can straight accessed message.fromorg since there no fromorg within messageattachment array.
javascript jquery jquery-templates
Comments
Post a Comment