The Angular CLI is arguably the most powerful part of the Angular framework. It gives you the power to generate new projects, components, and services—it even gives you the power to completely port your project's code to the next Angular version! In this guide, you will learn how to use the Angular CLI to generate a new Angular project.
Let's get started!
The Angular CLI can be downloaded onto your machine by running the following command using NPM:
npm install -g @angular/cli
You can now use the
ng command to access the CLI. To see a full listing of available commands, run
The command that you will be learning in this guide is the
ng new command. Bootstrapping an Angular app via the CLI is as simple as running:
ng new my-app
This command will create a new Angular app within your current directory that is named
my-app. In the following section, you will learn how to further customize the generation of your new Angular project via direct use of the available options.
Apart from following the on-screen prompts, it may be useful for you to use the options directly. This is especially true when you have your own project tooling that wraps the Angular CLI. According to the Angular CLI
ng-new schematic's schema.json file, the following options are available to use:
These aren't even all of the options! As you can see, the Angular CLI is extremely flexible when it comes to generating new projects and gives you a lot of control and customization.
You have now learned how to easily generate a new Angular app via the Angular CLI. You have learned that you can use the
ng new command and follow the on-screen prompts to generate your new project. Not only this, but you learned about all of the options that you can use directly with the
ng new command to further customize your experience. With the help of these available options, you can be confident when it comes to generating new Angular apps!