w2ui
Home
Get started
Demos
Docs
Blog
Support
Layout
Grid
Toolbar
Sidebar
Tabs
Form
Popup
Utilities
ver 1.3
ver 1.4
ver 1.5
ver 2.0
Utilities
Overview
Properties
Methods
Other
Events
Extending
w2utils.execTemplate
Fills out a template with provided variables
execTemplate(str, obj)
str
string
, a template to fill out
obj
Object
, variables for the template
The
str
argument is a template with variables in it. The second argument
obj
is an object with variables.
w2utils.execTemplate("This is ${a} template ${string}, can't ${you} see?") // returns: "This is ${a} template ${string}, can't ${you} see?" w2utils.execTemplate("This is ${a} template ${string}, can't ${you} see?", {}) // returns: "This is a template string, can't you see?" w2utils.execTemplate("This is ${a} template ${string}, can't ${you} see?", { a: "one fancy", string: "StRiNg" }) // returns: "This is one fancy template StRiNg, can't you see?"
User Comments
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus