Question

In the documentation of RactiveJS, we just have condition in template to test if a variable is true or false... It's possible to make a little more details ?

A thing like {{#var==1 && var2==2}}HTML CODE{{/var}} ?

I have a lot of possibilities for a form and If I need to observe each variable for making conditions, it's really long & hardest...

If we can't, someone can give me an advice to find a good library to make data-binding =)

Edit:

After more tests, I discover this code is ok

{{# var1 == '1' || var2 == '2'}}OK{{/}}

But this code isn't

{{# var1 == '1' && var2 == '2'}}OK{{/}}

It's normal ?

Plunkr => http://plnkr.co/edit/09OwnGzcf9SgJUSEdlC5?p=preview

Was it helpful?

Solution

As I mentioned on the github issue, your ampersands are getting converted to &amp;. Use a <script> tag, not a <form>.

http://plnkr.co/edit/Ig0Z9u07gYnnGk0tP6Zy?p=preview

You can also add functions to the ractive instance and call those if you need to handle more complex logic:

{{# isOk(var1, var2) }} OK {{/}}

Or you can put your logic into your model (if it belongs there).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top