Skip to content

Mapping the same partial multiple times with collections example #126

@JMoli

Description

@JMoli

Just started playing with Plates. Struggled with getting multiple partials to work nicely. Here is an example of how I got it to work:

var partial = '<li class="partial"></li>';
var base = '<div><h1 class="foo"></h1><ul class="menu"></ul></div>';
var collection = [{'partial':'test1'},{'partial':'test2'},{'partial':'test3'}];
var multiPartial = Plates.bind(partial, collection);
var mapping = Plates.Map();
mapping.class('menu').append(multiPartial);
var baseData = { foo: 'bar' };
console.log(Plates.bind(base, baseData, mapping));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions