English 中文(简体)
Mustache section in Couchdb issues
原标题:Mustache section in Couchdb issues

我是一只新教区,从1.0.1开始。

I have a very basic issue. I cannot get Mustache Sections to render in a list. Here is my list with the data hard coded from an example.

function(head, req) {
    start({
        "headers": {
            "Content-Type": "text/html"
        }
    });
var mustache = require("lib/mustache");
var view = {name: "Joe s shopping card",items: ["bananas", "apples"]};
var template = "{{name}}: <ul> {{#items}}<li>{{.}}</li>{{/items}} </ul>";
return mustache.to_html(template,view);

产出:

Joe s shopping card: <ul> <li></li><li></li></ul>

Please help!!!

Thank you, / Jeff

问题回答

奥赫拉夫,我只是说得 out,这是一点不言而喻的。 这里是想节省一定时间的其他人。 在您的模板中添加“i{% ImpLICIT-ITERATOR”。

因此:

var template = "{{name}}: <ul> {{#items}}<li>{{.}}</li>{{/items}} </ul>";

Becomes:

var template = "{{%IMPLICIT-ITERATOR}}{{name}}: <ul> {{#items}}<li>{{.}}</li>{{/items}} </ul>";




相关问题
couchdb for /really/ distributed replica

let s say i want to implement a distributed database (each node being the replica of the others); i hear that cdb is able to easily sync between two nodes and at least support some form of conflict ...

CouchDB View, Map, Index, and Sequence

I think read somewhere that when a View is requested the "map" is only run across documents that have been added since the last time it was requested? How is this determined? I thought I saw something ...

representing a many-to-many relationship in couchDB

Let s say I m writing a log analysis application. The main domain object would be a LogEntry. In addition. users of the application define a LogTopic which describes what log entries they are ...

couchDB , python and authentication

I have installed couchDB v 0.10.0, and am attempting to talk to it via python from Couch class downloaded from couchDB wiki. Problem is: Create database mydb : { error : unauthorized , reason : ...

Temp View Caching?

I m using CouchDB with a home-grown C# interface library. The most common method of accessing CouchDB with this library results in a temp view being created. I ve optimized the library so that it uses ...

热门标签