handle bar helper -- if extension


Handlebars.registerHelper('if_eq', function (a, b, opts) {
        if (a == b)
            return opts.fn(this);
        else
            return opts.inverse(this);
    });




usage :


 {{#each Values}}
            
                {{Date}}
                {{TransactionNo}}
                {{DepositType}}
                {{#if_eq StatusCode 0}}
                {{Status}}
                {{/if_eq }}
                {{#if_eq StatusCode 1}}
                {{Status}}
                {{/if_eq}}
                {{#if_eq StatusCode 2}}
                {{Status}}
                {{/if_eq}}


                {{Amount}}
            
            {{/each}}

你可能感兴趣的:(handle bar helper -- if extension)