Creating Your First Angular App
✅ Prerequisites
Make sure you have:
- Node.js installed (
node -v
) - Angular CLI installed (
ng version
)
If not, install with:
npm install -g @angular/cli
๐ Step-by-Step: Create Your Angular App
๐ง Step 1: Create the App
Run this command in your terminal:
ng new my-first-app
You’ll be prompted with:
- Would you like to add Angular routing? → Type
Yes
orNo
- Which stylesheet format would you like to use? → Choose
CSS
(or SCSS, etc.)
This will generate a new folder my-first-app
with the full Angular project structure.
๐ Step 2: Navigate to the Project
cd my-first-app
๐งช Step 3: Serve the Application
ng serve
By default, the app runs on http://localhost:4200
. Open your browser and go to:
http://localhost:4200
You should see the default Angular Welcome page! ๐
๐ ️ Project Structure Overview
Folder / File | Purpose |
---|---|
src/app/ |
Your app's main code (components, services, etc.) |
src/app/app.component.ts |
Main component logic |
src/app/app.component.html |
Main view (HTML) |
angular.json |
Angular project configuration |
package.json |
Project dependencies |
node_modules/ |
Installed packages |
main.ts |
Entry point for bootstrapping the app |
๐ฏ What Next?
- Create your first component:
ng generate component my-component
- Add routing
- Fetch data from an API
- Style your app with Angular Material or Bootstrap
Comments
Post a Comment