can-stache
Version:
Live binding handlebars templates
29 lines (18 loc) • 745 B
Markdown
else}} FALSY {{/ and }}`
`and( x, y )` works just like `x && y`. You can use it directly within a magic tag like:
```js
import {stache} from "can";
var view = stache(`{{# and(this.x, this.y) }} YES {{else}} NO {{/ and }}`);
var fragment = view({ x: 1, y: true});
console.log(fragment.firstChild.nodeValue) //-> YES
document.body.append(fragment);
```
You can use `and` in a nested expression like:
```html
{{# if( and(this.x, this.y) ) }} YES {{else}} NO {{/ and }}
```
`and` also takes multiple arguments. `and( x, y, z )` works just like `x && y && z`.
can-stache.helpers.and and
can-stache.htags
Perform a logical AND (&&).
`{{# and([EXPRESSION...]) }} TRUTHY {{