Search⌘ K

Creating the HomeComponent

Explore how to create the HomeComponent in your Angular app, update its template, and configure routing to display it at the root path. Learn about the router-outlet directive and how the component integrates with the app's structure for proper view rendering.

Create the component

We can now set up our first route and direct it to our home component. First, make sure you are in the new lets-get-lunch directory. Then create the component.

ng g component home
Terminal 1
Terminal
Loading...

The command ng g component home created four files and updated one:

CREATE src/app/home/home.component.css
CREATE src/app/home/home.component.html
CREATE src/app/home/home.component.spec.ts
CREATE src/app/home/home.component.ts
UPDATE
...