From the course: Mastering Nest.js: Build Scalable Applications with Mastery in Nest.js Framework

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Conditional rendering: No product found

Conditional rendering: No product found

So, currently, we are rendering the static product data inside the home page. Eventually, we will implement the functionality which renders the product data from the database. But still, when there won't be any data inside the database, there has to be an appropriate message displayed to the users. And that's exactly what we are going to create in this lecture. So we already have an if condition to render the products from the array. Now all we need to put is an else part. So here after the ending of if block, I'll give the else block. I'll open the curly braces and to close the curly braces, I'll give another ejs scriptlet and closing the curly bracket. Inside I'll give a division and an h1 with the message, no products available. And an anchor tag that redirects to the ad product page. For now, the reference will be set to a hash sign. Let's check the output now. And the message and link is getting displayed. Let's style them using the bootstrap classes. For division, I'll give…

Contents