I started using mustache.js and so far I am very impressed. Although I am puzzled by two things. The first leads to the second, so bear with me.
My json
{"goalsCollection": [ { "Id": "d5dce10e-513c-449d-8e34-8fe771fa464a", "Description": "Multum", "TargetAmount": 2935.9, "TargetDate": "/Date(1558998000000)/" }, { "Id": "eac65501-21f5-f831-fb07-dcfead50d1d9", "Description": "quad nomen", "TargetAmount": 6976.12, "TargetDate": "/Date(1606953600000)/" } ]};
My control function
function renderInvestmentGoals(collection) { var tpl = '{{#goalsCollection}}<tr><td>{{Description}}</td><td>{{TargetAmount}}</td><td>{{TargetDate}}</td></tr>{{/goalsCollection}}'; $('#tblGoals tbody').html('').html(Mustache.to_html(tpl, collection)); }
Q1 As you can see, my TargetDate needs to be parsed, but I'm not sure how to do this in my current function.
Q2 Let's say I wanted to perform some function or formatting on one or more of my objects before rendering, what is the best way to do this?
json string mustache date-parsing
Doooie
source share