Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial Rendering Clarification - Documentation, Question #635

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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.

None yet

2 participants