I am using Google Closure template first time.
Can we use Bitwise operator in Google Closure Template.
I want to use some thing like this:
{if $saleStatus.errors & $constant.displayValue}
<div class="displaye">
<msg desc="user is banned">
User is Banned.
</msg>
</div>
{/if}
Here i want to use Bitwise operator but i throws error of Syntax Exception.
Or is there any way i should use. May be to include js and do something there ?
Bitwise AND is not a supported operator in Google Closure templates. You should evaluate this in JavaScript prior to calling the template, and pass it in as a parameter. See the list of supported operators.
For example, something like this...
in JavaScript:
var err = saleStatus.errors & constant.displayValue;
$(elem).html(namespace.myTemplate, { err: err });
in Soy/closure:
....
/**
* Example ...
* @param err The error
*/
{template .myTemplate}
{if err}
<div class="displaye">
<msg desc="user is banned">
User is Banned.
</msg>
</div>
{/if}
{/template}
For more information about the concepts, please see the documentation.