Commandes Angular CLI - Guide complet des options ng

🏷️ Lignes des commandes 📅 06/01/2026 08:00:00 👤 Mezgani said
Angular Cli Ng Commandes Framework Frontend Typescript Composants Modules Services Routing Testing Déploiement

Guide complet des commandes Angular CLI. Découvrez toutes les options ng pour créer des projets, générer des composants, tester et déployer vos applications Angular avec productivité.

Ligne de commande :
ng new
Description :

Crée un nouveau projet Angular

Options :
  • --collection
  • -c
  • --commit
  • --create-application
  • --defaults
  • --directory
  • --dry-run
  • -d
  • --force
  • --inline-style
  • --inline-template
  • --interactive
  • --minimal
  • --new-project-root
  • --package-manager
  • --prefix
  • -p
  • --routing
  • --skip-git
  • --skip-install
  • --skip-tests
  • --standalone
  • --strict
  • --style
  • --view-encapsulation

Ligne de commande :
ng generate
Description :

Génère des fichiers Angular (composants, services, modules, etc.)

Options :
  • --defaults
  • --dry-run
  • -d
  • --force
  • --interactive

Ligne de commande :
ng generate component
Description :

Génère un nouveau composant Angular

Options :
  • --change-detection
  • --display-block
  • --dry-run
  • -d
  • --export
  • --flat
  • --inline-style
  • -s
  • --inline-template
  • -t
  • --module
  • -m
  • --prefix
  • -p
  • --project
  • --selector
  • --skip-import
  • --skip-selector
  • --skip-tests
  • --standalone
  • --style
  • --type
  • --view-encapsulation

Ligne de commande :
ng g c
Description :

Alias pour générer un composant

Options :
  • --change-detection
  • --display-block
  • --dry-run
  • -d
  • --export
  • --flat
  • --inline-style
  • -s
  • --inline-template
  • -t
  • --module
  • -m
  • --prefix
  • -p
  • --project
  • --selector
  • --skip-import
  • --skip-selector
  • --skip-tests
  • --standalone
  • --style
  • --type
  • --view-encapsulation

Ligne de commande :
ng generate directive
Description :

Génère une nouvelle directive Angular

Options :
  • --dry-run
  • -d
  • --export
  • --flat
  • --module
  • -m
  • --prefix
  • -p
  • --project
  • --selector
  • --skip-import
  • --skip-selector
  • --skip-tests
  • --standalone

Ligne de commande :
ng g d
Description :

Alias pour générer une directive

Options :
  • --dry-run
  • -d
  • --export
  • --flat
  • --module
  • -m
  • --prefix
  • -p
  • --project
  • --selector
  • --skip-import
  • --skip-selector
  • --skip-tests
  • --standalone

Ligne de commande :
ng generate pipe
Description :

Génère un nouveau pipe Angular

Options :
  • --dry-run
  • -d
  • --export
  • --flat
  • --module
  • -m
  • --name
  • --project
  • --skip-import
  • --skip-tests
  • --standalone

Ligne de commande :
ng g p
Description :

Alias pour générer un pipe

Options :
  • --dry-run
  • -d
  • --export
  • --flat
  • --module
  • -m
  • --name
  • --project
  • --skip-import
  • --skip-tests
  • --standalone

Ligne de commande :
ng generate service
Description :

Génère un nouveau service Angular

Options :
  • --dry-run
  • -d
  • --flat
  • --module
  • -m
  • --project
  • --skip-tests

Ligne de commande :
ng g s
Description :

Alias pour générer un service

Options :
  • --dry-run
  • -d
  • --flat
  • --module
  • -m
  • --project
  • --skip-tests

Ligne de commande :
ng generate module
Description :

Génère un nouveau module Angular

Options :
  • --dry-run
  • -d
  • --flat
  • --module
  • -m
  • --project
  • --route
  • --routing
  • --routing-scope

Ligne de commande :
ng g m
Description :

Alias pour générer un module

Options :
  • --dry-run
  • -d
  • --flat
  • --module
  • -m
  • --project
  • --route
  • --routing
  • --routing-scope

Ligne de commande :
ng generate class
Description :

Génère une nouvelle classe TypeScript

Options :
  • --dry-run
  • -d
  • --project
  • --skip-tests
  • --type

Ligne de commande :
ng g cl
Description :

Alias pour générer une classe

Options :
  • --dry-run
  • -d
  • --project
  • --skip-tests
  • --type

Ligne de commande :
ng generate interface
Description :

Génère une nouvelle interface TypeScript

Options :
  • --dry-run
  • -d
  • --prefix
  • --project
  • --type

Ligne de commande :
ng g i
Description :

Alias pour générer une interface

Options :
  • --dry-run
  • -d
  • --prefix
  • --project
  • --type

Ligne de commande :
ng generate enum
Description :

Génère une nouvelle énumération TypeScript

Options :
  • --dry-run
  • -d
  • --project
  • --type

Ligne de commande :
ng g e
Description :

Alias pour générer une énumération

Options :
  • --dry-run
  • -d
  • --project
  • --type

Ligne de commande :
ng generate guard
Description :

Génère un nouveau guard de route Angular

Options :
  • --dry-run
  • -d
  • --flat
  • --functional
  • --implements
  • --project
  • --skip-tests

Ligne de commande :
ng g g
Description :

Alias pour générer un guard

Options :
  • --dry-run
  • -d
  • --flat
  • --functional
  • --implements
  • --project
  • --skip-tests

Ligne de commande :
ng generate interceptor
Description :

Génère un nouvel intercepteur HTTP

Options :
  • --dry-run
  • -d
  • --flat
  • --functional
  • --project
  • --skip-tests

Ligne de commande :
ng generate resolver
Description :

Génère un nouveau resolver de route

Options :
  • --dry-run
  • -d
  • --flat
  • --functional
  • --project
  • --skip-tests

Ligne de commande :
ng g r
Description :

Alias pour générer un resolver

Options :
  • --dry-run
  • -d
  • --flat
  • --functional
  • --project
  • --skip-tests

Ligne de commande :
ng generate web-worker
Description :

Génère un nouveau Web Worker

Options :
  • --dry-run
  • -d
  • --project

Ligne de commande :
ng generate environments
Description :

Génère les fichiers d'environnement

Options :
  • --dry-run
  • -d
  • --project

Ligne de commande :
ng generate library
Description :

Génère une nouvelle bibliothèque dans un workspace

Options :
  • --dry-run
  • -d
  • --entry-file
  • --prefix
  • -p
  • --project-root
  • --skip-install
  • --skip-package-json
  • --skip-tests
  • --standalone

Ligne de commande :
ng g lib
Description :

Alias pour générer une bibliothèque

Options :
  • --dry-run
  • -d
  • --entry-file
  • --prefix
  • -p
  • --project-root
  • --skip-install
  • --skip-package-json
  • --skip-tests
  • --standalone

Ligne de commande :
ng generate application
Description :

Génère une nouvelle application dans un workspace

Options :
  • --dry-run
  • -d
  • --inline-style
  • --inline-template
  • --minimal
  • --prefix
  • -p
  • --project-root
  • --routing
  • --skip-install
  • --skip-package-json
  • --skip-tests
  • --standalone
  • --strict
  • --style

Ligne de commande :
ng g app
Description :

Alias pour générer une application

Options :
  • --dry-run
  • -d
  • --inline-style
  • --inline-template
  • --minimal
  • --prefix
  • -p
  • --project-root
  • --routing
  • --skip-install
  • --skip-package-json
  • --skip-tests
  • --standalone
  • --strict
  • --style

Ligne de commande :
ng serve
Description :

Lance le serveur de développement Angular

Options :
  • --allowed-hosts
  • --aot
  • --base-href
  • --browser-target
  • --build-event-log
  • --common-chunk
  • --configuration
  • -c
  • --deploy-url
  • --disable-host-check
  • --force-esbuild
  • --help
  • --hmr
  • --host
  • --live-reload
  • --open
  • -o
  • --optimization
  • --poll
  • --port
  • --prebundle
  • --project
  • --proxy-config
  • --public-host
  • --serve-path
  • --ssl
  • --ssl-cert
  • --ssl-key
  • --verbose
  • --vendor-chunk
  • --watch

Ligne de commande :
ng build
Description :

Compile l'application Angular pour la production

Options :
  • --allowed-common-js-dependencies
  • --aot
  • --base-href
  • --budgets
  • --build-optimizer
  • --common-chunk
  • --configuration
  • -c
  • --cross-origin
  • --delete-output-path
  • --deploy-url
  • --extract-licenses
  • --file-replacements
  • --i18n-missing-translation
  • --index
  • --inline-style-language
  • --localize
  • --main
  • --named-chunks
  • --ngsw-config-path
  • --optimization
  • --output-hashing
  • --output-path
  • --poll
  • --polyfills
  • --preserve-symlinks
  • --progress
  • --project
  • --prerender
  • --resources-output-path
  • --scripts
  • --service-worker
  • --source-map
  • --stats-json
  • --style
  • --subresource-integrity
  • --ts-config
  • --vendor-chunk
  • --verbose
  • --watch
  • --web-worker-tsconfig

Ligne de commande :
ng test
Description :

Lance les tests unitaires avec Karma

Options :
  • --browsers
  • --code-coverage
  • --code-coverage-exclude
  • --configuration
  • -c
  • --exclude
  • --help
  • --include
  • --karma-config
  • --main
  • --poll
  • --polyfills
  • --preserve-symlinks
  • --progress
  • --project
  • --reporters
  • --source-map
  • --ts-config
  • --watch
  • --web-worker-tsconfig

Ligne de commande :
ng e2e
Description :

Lance les tests end-to-end

Options :
  • --base-url
  • --configuration
  • -c
  • --dev-server-target
  • --grep
  • --host
  • --invert-grep
  • --port
  • --project
  • --protractor-config
  • --specs
  • --suite
  • --webdriver-update

Ligne de commande :
ng lint
Description :

Lance le linter sur le code Angular

Options :
  • --configuration
  • -c
  • --exclude
  • --files
  • --fix
  • --force
  • --format
  • --help
  • --project
  • --quiet
  • --silent

Ligne de commande :
ng add
Description :

Ajoute un package Angular avec configuration automatique

Options :
  • --defaults
  • --dry-run
  • -d
  • --package-manager
  • --registry
  • --skip-confirmation
  • --verbose

Ligne de commande :
ng update
Description :

Met à jour Angular et ses dépendances

Options :
  • --allow-dirty
  • --create-commits
  • --dry-run
  • -d
  • --force
  • --from
  • --help
  • --migrate-only
  • --name
  • --next
  • --package-manager
  • --registry
  • --to
  • --verbose

Ligne de commande :
ng deploy
Description :

Déploie l'application Angular

Options :
  • --configuration
  • -c
  • --dry-run
  • -d
  • --no-build
  • --project

Ligne de commande :
ng config
Description :

Récupère ou définit des valeurs de configuration Angular

Options :
  • --global
  • --help
  • --json-path

Ligne de commande :
ng doc
Description :

Ouvre la documentation officielle Angular

Options :
  • --help
  • --search
  • --version

Ligne de commande :
ng version
Description :

Affiche les versions d'Angular CLI et des dépendances

Options :
  • --help

Ligne de commande :
ng analytics
Description :

Gère les paramètres d'analytics Angular CLI

Options :
  • --help

Ligne de commande :
ng cache
Description :

Gère le cache de build Angular

Options :
  • clean
  • disable
  • enable
  • info

Ligne de commande :
ng completion
Description :

Génère un script d'autocomplétion pour le shell

Options :
  • --help

Ligne de commande :
ng extract-i18n
Description :

Extrait les messages i18n du code source

Options :
  • --browser-target
  • --build-optimizer
  • --configuration
  • -c
  • --cross-origin
  • --delete-output-path
  • --deploy-url
  • --extract-licenses
  • --file-replacements
  • --format
  • --i18n-locale
  • --index
  • --main
  • --named-chunks
  • --optimization
  • --output-hashing
  • --output-path
  • --preserve-symlinks
  • --progress
  • --project
  • --resources-output-path
  • --scripts
  • --source-map
  • --stats-json
  • --style
  • --subresource-integrity
  • --ts-config
  • --vendor-chunk
  • --verbose
  • --watch
  • --web-worker-tsconfig

Ligne de commande :
ng run
Description :

Exécute une cible d'architecte personnalisée

Options :
  • --configuration
  • -c
  • --help
  • --project
  • --target

Ligne de commande :
ng xi18n
Description :

Extrait les messages i18n (alias de extract-i18n)

Options :
  • --browser-target
  • --build-optimizer
  • --configuration
  • -c
  • --cross-origin
  • --delete-output-path
  • --deploy-url
  • --extract-licenses
  • --file-replacements
  • --format
  • --i18n-locale
  • --index
  • --main
  • --named-chunks
  • --optimization
  • --output-hashing
  • --output-path
  • --preserve-symlinks
  • --progress
  • --project
  • --resources-output-path
  • --scripts
  • --source-map
  • --stats-json
  • --style
  • --subresource-integrity
  • --ts-config
  • --vendor-chunk
  • --verbose
  • --watch
  • --web-worker-tsconfig