Angular First App
π Build Your First Angular App
1οΈβ£ Install Angular CLI
Open your terminal (CMD/PowerShell):
2οΈβ£ Create a New Angular Project
CLI will ask:
-
Add Angular routing? β
Yes -
Stylesheet format? β
CSS
This creates a folder named first-app with all Angular files.
3οΈβ£ Run the App
Now open your browser β
π http://localhost:4200/
You will see the Angular default welcome page. π
π§© 4οΈβ£ Create Your First Component
Letβs create a component called hello:
Angular creates:
βοΈ 5οΈβ£ Write Some Content in Your Component
Open hello.component.html and add:
π 6οΈβ£ Display the Component on the Page
Open app.component.html and add:
Now check the browserβyour message appears!
π 7οΈβ£ Add Data Binding Example
In hello.component.ts:
In hello.component.html:
Angular automatically updates the UI. βοΈ
π 8οΈβ£ Add a Button (Event Binding Example)
hello.component.html
hello.component.ts
π§ What You Learned
By now you have built a functioning Angular app with:
β
Component creation
β
HTML templates
β
Data binding
β
Event handling
β
First working UI
