Skip to content

Conversation

@brian-lim-42
Copy link

Following code snippet shows issue

var view = {
   name: 'test name 1',
   names: [
      { name: 'test name 2' },
      { name: 'test name 3' }
   ],
   partial: {
      names: [
         { name: 'test name 4' },
         { name: 'test name 5' }
      ]
   }
};

var template = '{{#names}}Hi, {{name}}!{{/names}} PARTIAL TEST : {{> partial}}'
var partial = '{{#names}}Hello, my name is {{name}}.{{/names}}'
console.log(Mustache.render(template, view, { partial: partial}));

This does not render 4 and 5 as expected with nested views a la common web view engines (documentation is exacting, "thought of as one single template" is literal)

Updated documentation to reflect this

Is there appetite for contexts ? I could pull request a non-breaking option for nested partial support... I do not want to switch to handlebars for such a basic functionality unless I have to

Thanks

~ B

@dasilvacontin
Copy link
Collaborator

@bhldev Hi!

Looks pretty good to me. Maybe adding the actual output of the sample, for clarity?

Cheers!

@brian-lim-42
Copy link
Author

Updated pull with example 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants