Building the Landing Page

Introduction: Welcome to the Landing Page

Welcome back! So far, you connected the Angular frontend with the backend. In this lesson, we will focus on creating the template for the landing page of our Cooking Helper app. The landing page is the first thing users see when they visit your site. It should be clear, inviting, and easy to use.

By the end of this lesson, you will know how to build a well-structured Angular component template for the landing page. This will set the foundation for adding more features and interactivity in later lessons. Let’s get started!

Recall: Key HTML and Angular Template Concepts

Before we dive in, let’s quickly remind ourselves of a few important concepts:

  • HTML Structure: HTML is the language used to create web pages. It uses tags like <html>, <head>, and <body> to organize content.
  • Angular Components: In Angular, the UI is built using components. Each component has its own HTML template, TypeScript class, and optional CSS for styling.
  • Component Templates: Angular templates use regular HTML but also support special syntax for data binding, event handling, and conditionally displaying content.
  • Routing: Angular uses a router to map URLs to components. For example, the home page is usually mapped to a HomeComponent.
  • Data Binding: Angular lets you bind data from your component class to the template using curly braces ({{ }}) and bind events using parentheses (e.g., (click)).

If any of these ideas are new to you, don’t worry! We’ll see them in action as we build the landing page.

Breaking Down the Landing Page Structure

Let’s look at what our landing page needs. We want users to be able to:

  • Search for recipes by entering ingredients.
  • See the results of their search.
  • View a list of popular recipes.
  • Get a random recipe if they’re feeling adventurous.

To make this possible, our landing page will have four main sections:

  1. Search Section: A form where users can type in ingredients.
  2. Search Results Section: A place to show recipes that match the search.
  3. Popular Recipes Section: A list of recipes that are popular right now.
  4. Random Recipe Section: A button to get a random recipe and a spot to display it.

We will use this file structure

tree
src/
└─ app/
    ├─ home/
    │   ├─ home.component.ts
    │   ├─ home.component.html
    │   └─ home.component.css
    ├─ models/
    │   └─ recipe.model.ts
    └─ services/
        └─ api.service.ts

By organizing the page this way, we make it easy for users to find what they need and explore new ideas.

Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal