JsRender Demos

Example Scenario: providing default values for data.

The simplest (and best) way: Javascript expression '||':
{{>languages||'Languages unavailable'}}
Title{{>path}}
Creating a special custom tag:
{{get languages defaultValue="No languages!"/}}

$.views.tags({
    get: function( value ) {
        return value || this.ctx.props.defaultValue;
    }
});
Title{{get path default="..."}}
Creating a multi-purpose utility tag:
{{yesNo languages yes="Alternate languages available:" no="No alternate languages"/}}

$.views.tags({
    yesNo: function( value ) {
        return value ? this.tagCtx.props.yes : this.tagCtx.props.no;
    }
});
Title{{yesNo path yes="..." no="..."}}