Logic
{#if ... }
Learn how to use if / else statements in your views
Introduction
In this guide, we will learn how to use if
and else
statements in your views. This is useful when you want to conditionally render some content based on a certain condition.
Basic usage
Here’s an example of how to use if
and else
statements in your views to display a message or a chart depending on whether the query result is empty or not.
Using query results as conditions
You can also use any query result to conditionally render content. To do so, use the await
syntax to wait for the query to resolve before using the result.
Learn more about how to use await in the Await documentation.