“ax5.mustache” is a modified version of mustache in the “https://github.com/janl/mustache.js”, some of the syntax.
ax5.mustache.render(template, view)
Argument01_template, Argument02_view, Usage, Output
Argument01_ template:
var tmpl = "{{title}} spends {{calc}}";
Argument02_ view:
var view = {
title: "Joe",
calc: function () {
return 2 + 4;
}
};
Usage_ ax5.mustache.render(template, view):
var output = ax5.mustache.render(template, view);
Output_ console.log(output):
Joe spends 6
This module is almost like as the basic usage of mustach. Please refer to the Mustache API.
You can use all API of
mustache
in the same way. I will introduce the features added in theax5.mustache
below.
Argument01_template, Argument_view, Usage, Output
Argument01_ template:
var template =
"
{{#beatles}}
* {{firstName}} {{lastName}} ({{@i}}) ({{@first}})
{{/beatles}}
"
Argument02_ view:
var view = {
"beatles": [
{ "firstName": "John", "lastName": "Lennon" },
{ "firstName": "Paul", "lastName": "McCartney" },
{ "firstName": "George", "lastName": "Harrison" },
{ "firstName": "Ringo", "lastName": "Star" }
]
};
Usage_ ax5.mustache.render(template, view):
var output = ax5.mustache.render(template, view);
Output:
* John Lennon (0) (true)
* Paul McCartney (1) (false)
* George Harrison (2) (false)
* Ringo Star (3) (false)
Argument01_template, Argument02_view, Usage, Output
Argument01_ template:
var template=
"
{{#beatles}}
{{#@each}}
* {{@key}} : {{@value.firstName}} {{@value.lastName}}
{{/@each}}
{{/beatles}}
"
Argument02_ view
var view = {
"beatles": {
"John": {"firstName": "John", "lastName": "Lennon"},
"Paul": {"firstName": "Paul", "lastName": "McCartney"},
"George": {"firstName": "George", "lastName": "Harrison"},
"Ringo": {"firstName": "Ringo", "lastName": "Star"}
}
}
Usage_ ax5.mustache.render(template, view):
var output = ax5.mustache.render(template, view);
Output:
* John : John Lennon
* Paul : Paul McCartney
* George : George Harrison
* Ringo : Ringo Star
'AX5UI' can be used with Bootstrap theme. The development of the distribution of the various UI plug-in. When you click the link to move to AX5UI index page.
AXBoot makes it easy to build web applications with Java & HTML5 Repeatable and noise development process are resolved by AXBoot.