Create new angular app
Here are the steps to create a new Angular app:
Using the Angular CLI
-
Open a terminal or command prompt.
-
Install the Angular CLI by running the following command:
npm install -g @angular/cli
-
Create a new Angular app by running the following command:
ng new my-app
Replace
my-app
with the name of your app. -
Follow the prompts to choose the app template and configuration options.
Using the Angular CLI with a specific version
If you want to create an app with a specific version of Angular, you can specify the version when running the ng new
command. For example:
ng new my-app --version 12
This will create an app with Angular 12.
Using the Angular CLI with a custom template
If you want to create an app with a custom template, you can specify the template name when running the ng new
command. For example:
ng new my-app --template full
This will create an app with the full template, which includes routing, services, and other features.
Using the Angular CLI with a specific package manager
If you want to create an app with a specific package manager (e.g. Yarn), you can specify the package manager when running the ng new
command. For example:
ng new my-app --package-manager yarn
This will create an app with Yarn as the package manager.
Using the Angular CLI with a custom directory
If you want to create an app in a custom directory, you can specify the directory path when running the ng new
command. For example:
ng new my-app --directory /path/to/my/app
This will create an app in the specified directory.
Verify the app creation
Once the app is created, you can verify that it was created successfully by running the following command:
ng serve
This will start the development server and open the app in your default web browser.
That's it! You now have a new Angular app created using the Angular CLI.