Angular CLI
Angular projects are typically developed and managed using the Angular CLI (Command Line Interface). The Angular CLI provides a set of commands that help you create, build, test, and deploy your Angular applications. Here are some of the main commands that are commonly used in Angular development:
Create a New Project:
ng new project-nameCreates a new Angular project with the specified name.
Generate a Component:
ng generate component component-nameGenerates a new Angular component.
Generate a Service:
ng generate service service-nameGenerates a new Angular service.
Generate a Module:
ng generate module module-nameGenerates a new Angular module.
Build the Application:
ng buildBuilds the Angular application for production. Use
--prodflag for optimized production build.Serve the Application:
ng serveStarts a development server and serves your application. By default, the app will be available at
http://localhost:4200/.Run Tests:
ng testRuns unit tests using Karma.
Run End-to-End Tests:
ng e2eRuns end-to-end tests using Protractor.
Generate Component/Service/Module/Class...:
ng generate <schematic> <name>Generates various elements like components, services, modules, classes, directives, etc.
Lint the Code:
ng lintChecks the code for linting issues using TSLint or ESLint.
Update Dependencies:
ng updateUpdates the project's dependencies based on the
package.jsonfile.Generate Documentation:
ng doc <keyword>Opens Angular documentation in a browser based on a keyword.
These are just a few of the most commonly used Angular CLI commands. The Angular CLI provides a comprehensive set of commands to streamline the development process and maintain best practices. You can get more information about each command and its options by running ng help or by visiting the official Angular CLI documentation.