How to install Angular with the CLI?
If you visit the official website above, you can see that there are some commands written. These are the 4 main steps to install an Angular project:
- Node Package Manager (NPM) installation
- Angular CLI installation
- Creating an Angular app with the CLI
- Running the app
Let’s see them in details…
1. Install NPM
Angular requires Node.js in your system (version 8.x or 13.x). If you already have it, you can skip this part.
Node has the Node Package Manager (NPM), which we need for installing Angular CLI and other programs (packages). You can download NPM from here.
After finish the installation, go to your Terminal or Windows Command Prompt and type node -v to check which version is installed:
2. Install Angular CLI
After NPM installation, you can install Angular CLI as the next step. Open your terminal or command prompt and type the command below:
npm install -g @angular/cli
‘g’ stands for global installation. We include it so we can use the CLI in any Angular project later. After the installation is completed, type
ng v to verify whether the installation is successful.
3. Create Your First Angular App
Now you can install your Angular App with the help of CLI. First choose a path for where you to start your App. I am going to start my app with help of cd myFirstAngular to relocate my path, then go with the following command to install your first Angular project,
ng new my-first-app
Then it will ask you like Would you like to add Angular routing? Y / N
If you need to connect your project with routing just say Y, else confirm N.
Next step it will ask which Style sheet you are going to use, Which stylesheet format would you like to use?
CSS, SCSS, Sass, Lass. After selection of Stylesheet, Here we go with the code installation.
4. Run the App
After your Angular App is initialized successfully, go to your project folder with cd name-of-your-app.
Finally you can run the Angular app with the following command:
cd myFirstAngular ng serve --open
This command will start your Angular Application and the open command opens it automatically in your web browser:
Angular supports live server, so you can see the changes in your local browser automatically without refreshing the page.
A browser page will open. Your first Angular app is running on your localhost. oohhhooo..,
This is the Beginning Angular App screen for 8th version.
to be Continue…