Angular CLI In Depth
1.5 Angular CLI In Depth
Section titled “1.5 Angular CLI In Depth”The Angular CLI is a powerful tool to initialize, develop, scaffold, and maintain Angular applications. Common commands:
-
Generate a new component
Terminal window ng generate component user-profile# or shorthand: ng g c user-profileThis creates the component files and (if using modules) updates the module.
-
Generate a service
Terminal window ng generate service data -
Build the project
Terminal window ng buildOutputs the compiled files to the
dist/folder. -
Serve with development server
Terminal window ng serve --openOpens the app automatically.
-
Run unit tests
Terminal window ng test -
Run end‑to‑end tests
Terminal window ng e2e -
Update Angular and dependencies
Terminal window ng update
For a full list, run
ng help.