canjs / can-stache

Live binding handlebars templates
https://canjs.com/doc/can-stache.html
MIT License
10 stars 13 forks source link

Add inverse expression to support falsy values #681

Closed cherifGsoul closed 5 years ago

cherifGsoul commented 5 years ago

Currently inverse expressions is not supported Given this example with simple setter stache binding: <button on:click="this.isOpen = !isOpen">Toggle</button>

I'm not sure if we should add another expression type Inverse or just support this in Lookup type?

Related https://github.com/canjs/can-stache-bindings/issues/516

phillipskevin commented 5 years ago

You can do on:click="this.isOpen = not(isOpen)". I think this is still nice, but maybe not super important.

phillipskevin commented 5 years ago

And we should document using the not converter like this if it's not documented.