Wednesday, November 29, 2017

JS Mustache IF/Else

This how you set if/else in JS Mustache

test_template.mustache

//If the lists is not empty

#lists

//not empty

/lists


//Else if lists is empty

^lists

//empty

/lists

 $.get('test_template.mustache', function(template) 
var rendered = Mustache.render(template, lists: data);
$('#target').html(rendered);
);

More documentation here about JS Mustache https://github.com/janl/mustache.js/

No comments:

Post a Comment

 

blogger templates | Make Money Online