bminer / node-blade

Blade - HTML Template Compiler, inspired by Jade & Haml
Other
320 stars 28 forks source link

how to get embed document in blade ? #82

Closed crapthings closed 12 years ago

crapthings commented 12 years ago
function create_paper(model) {
    _.defaults(model, {
        nodes: [
            { _id: Meteor.uuid(), title: 'first one'}
        ],
        created_time: moment().format(),
        timestamp: new Date().getTime(),
        status: 'public'
    });
    var id = Papers.insert(model);
    return id;
};

how to get each nodes display on my page ?

!=
    paper.nodes.forEach(function(node) {
        console.log(node);
    });

i can use above code to show log in console but how to combie a template chunk or a better way to list embed document ?

crapthings commented 12 years ago

okay i've done in this way, but is there another solution ?

- paper.nodes.forEach(function(node) {
    p= node.title
-});
bminer commented 12 years ago

The solution you gave above is what I would suggest... except you don't need the curly braces

- paper.nodes.forEach(function(node)
    p= node.title
- )

If you want each in its own chunk, you can always do:

- paper.nodes.forEach(function(node)
    chunk
        p= node.title
    != Meteor.ui.chunk(__.chunk.last)
- )