I want to check for null values in Scriban.

{{ if (o_model.address.id) }}
<div  style="text-align: center;"><h5>Address {{ o_model.address.id}}</h5><br /></div>
{{ end }}

I am getting this error

error : Object `o_model.address` is null. Cannot access member: o_model.address.id

What I am doing wrong here?


This works

{{ if (o_model.address)}}
    {{ if (o_model.address.id)}}
    {{ end }} 
{{ end }}

Thanks Marek

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.