how to create a basic angular 9 app with Angular CLI
This article is part 1 of a series where I will gradually build up an Angular App with a Microsoft .Net Core API. In this article I create a simple Angular 9 application with the Angular CLI. I am using Windows 10.
Step 1 — install Angular CLI
In a command prompt navigate to the folder where you want to create your new app. Then type :
npm install -g @angular/cli
Check what version of Angular CLI you have by typing:
ng --version
Compare your version to the (latest) version on the Angular.io website. If it isn’t showing version 9 or above you might want to do the following to update Angular CLI:
npm uninstall @angular/clinpm install -g @angular/cli@latest
Step 2 — create the App
In your command prompt type:
- ng new example (example is the name I am using for the app)
- y when the command prompt asks “would you like to add Angular routing?”
- navigate to the format you prefer using the up and down arrows and hit enter when the command prompt asks “Which stylesheet format would you like to use?” I always use SCSS
After the installation process has finished type :
cd example
Step 3 — run your app
In your command prompt type :
ng serve
Open a new browser windows and navigate to http://localhost:4200 and you should see the following standard Angular welcome page :
You now have a working Angular 9 app.
Next — adding routing and a few components using the Angular CLI.
All the best.