質問

Does jsRender supports if statments like below ?

{{ if val > 1  }}
....
{{ /if }}

I couldn't find any examples. Also I understand that there is a variant of using helper functions.

役に立ちましたか?

解決

Yes, see www.jsviews.com/#iftag.

In fact you can write {{if pathOrExpr}} where path can be any combination of 'data paths' and reqular javascript operators etc.

The example shows {{if members && members.length}} and similarly you can do all the expected conditional expressions such as:

address.zip === '88888', or:

foo.count < 3 && foo.total >= bar.total,

etc. etc.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top