0

Been searching all day and still stuck on trying to access data from array object using Tempo.Tried using a variety of processes but not getting anywhere.

The array object that I'm trying to access is called options and the key is name.

<p>{{options:name}}</p>

4

1 回答 1

0

至少在没有数组对象的实例的情况下很难回答这个问题。我想你有这样的事情:

var data = {options:[
    {name:'Test Name'},
    {name:'Another Test Name'}
]}

只需在 Tempo 中准备后将选项数组分配给数据方法:

Tempo.prepare('container').data(data.options);

在 HTML 中:

<div id="container">
    <p data-template>{{name}}</p>
</div>
于 2014-02-10T00:16:13.880 回答