Commands
🏗️ Project Creation & Setup
| Command | Description | Example |
|---|
ng new | Create new Angular project | ng new my-app |
ng add | Add package to project | ng add @angular/material |
ng update | Update dependencies | ng update @angular/core |
ng config | Manage CLI configuration | ng config schematics.@schematics/angular:component.style scss |
🚀 Development Commands
| Command | Description | Example |
|---|
ng serve | Run development server | ng serve --port 4201 |
ng build | Build project | ng build --prod |
ng test | Run unit tests | ng test --watch |
ng e2e | Run end-to-end tests | ng e2e --port 4201 |
🧩 Component Generation
| Command | Description | Example |
|---|
ng generate component | Create new component | ng g c user-profile |
ng generate module | Create new module | ng g m admin |
ng generate service | Create new service | ng g s data |
ng generate directive | Create new directive | ng g d highlight |
ng generate pipe | Create new pipe | ng g p currency-format |
🏛️ Architecture Commands
| Command | Description | Example |
|---|
ng generate library | Create library project | ng g lib shared |
ng generate application | Create app in workspace | ng g app admin |
ng generate interface | Create interface | ng g i user |
ng generate enum | Create enum | ng g enum status |
🌐 Internationalization
| Command | Description | Example |
|---|
ng extract-i18n | Extract i18n messages | ng extract-i18n --output-path src/locale |
ng serve --configuration | Serve with locale config | ng serve --configuration=fr |
🔧 Utility Commands
| Command | Description | Example |
|---|
ng lint | Run linting | ng lint --fix |
ng deploy | Deploy application | ng deploy --base-href=/my-app/ |
ng doc | Search Angular docs | ng doc router |
ng version | Show CLI version | ng v |
🛠️ Advanced Commands
| Command | Description | Example |
|---|
ng run | Run custom target | ng run my-app:server |
ng cache | Manage build cache | ng cache clean |
ng analytics | Configure analytics | ng analytics off |
ng repair | Repair configuration | ng repair |
🎛️ Configuration Options
| Option | Description | Example |
|---|
--dry-run | Simulate command | ng g c demo --dry-run |
--skip-tests | Skip test files | ng g c home --skip-tests |
--style | Style preprocessor | ng new --style=scss |
--routing | Add routing module | ng new --routing |
💡 Tips Penggunaan
- Gunakan shortcut:
⚡ Tips Cepat
- Gunakan
--dry-run untuk melihat apa yang akan dibuat tanpa benar-benar membuatnya --skip-tests untuk melewati pembuatan file test--style=scss untuk menggunakan SCSS
💡 Gunakan ng help untuk melihat semua opsi yang tersedia