Creating angular seed or getting started project using angular-cli is pretty simple. In this article I will show you how it can be done in Windows. Follow the following steps –
Prerequisite:
If nodejs is not installed in you machine, install it first. You can download nodejs from https://nodejs.org/en/
To verify nodejs installation, open command prompt and type the following commands –
#> node -v
#> npm -v
This will display installed nodejs and npm version. Note that npm comes with nodejs inbuilt.
Steps to create angular app using angular-cli:
1. Install angular-cli:
Open command prompt and run the following command
#> npm install -g @angular/cli
We are installing angular-cli globally so that we don’t need to install it in every project locally.
2. Create angular app:
Open command prompt and run the following command –
D:\Projects> ng new first-angular-app
This command will create an angular app in the folder first-angular-app.
3. Run the app:
D:\Projects> cd first-angular-app
D:\Projects\first-angular-app> ng serve
Now, open browser and browse http://localhost:4200, that’s it! You have successfully created first angular app.