0% found this document useful (0 votes)
6 views9 pages

Angular Component

Uploaded by

HARSH VAIDYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views9 pages

Angular Component

Uploaded by

HARSH VAIDYA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Angular Component

Contents
• What is Component?
• Creating a new component
• Nesting component
• Component Lifecycles
What is Component?
• Component is the main building block of Angular App
• It has for elements
• HTML - defines what renders on page
• Typescript - a class that defines the behaviour
• Selector - defines how component is used
• CSS - defines the applied styles
Creating new component
To create new component:

• Create a folder called components


• Give following command @ terminal
• ng generate component details
• ng g c footer
• ng g c service
Nesting component
app.component.html
<app-details></app-details>

details.component.html
<app-service></app-service>

services.component.html
Component Lifecycle
• Angular components are at the heart of Angular applications, and they have a
lifecycle with various hooks that allow you to execute code at specific points during
a component's life.
• Understanding these lifecycle hooks is crucial for managing component behavior
and interactions.
Component Lifecycle
Component Lifecycle
?

You might also like