MustacheJS Conditionally Show DOM

I was able to figure out my issue. I was passing an object { title: 'Create User' } instead of the viewmodel. To fix the issue, I changed my viewmodel to include the title and passed the viewmodel when rendering the template like such:

var viewModel = {
    title: 'Create User',
    id: null,
    firstName: '',
    lastName: '',
    email: '',
    isActive: true
};
var template = document.getElementById('interface-upsert').innerHTML;
var rendered = Mustache.render(template, viewModel);
$('#interface-layout').html(rendered);

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top