In this section we will go through the steps involved in setting up Angular 7 project. Very recently angular team released version 7 of Angular. You can browse the latest features of Angular here.
After installing Node JS you will need to install angular cli. Angular CLI is a command line interface for Angular. Using Angular CLI it becomes very easy to develop, test and build angular applications.
To install angular cli open the npm terminal and use below command.
npm install –g @angular/cli
This command will install latest angular 7 version globally on your machine. If you are already using Angular 5 or 6 versions, above command will update your angular cli version to latest version i.e 7. Your existing applications may stop working after upgrading the angular version. So make sure you have latest Node JS version i.e 8.x or 10.x before installing angular.
If you are planning to upgrade existing angular application, please follow the instructions on https://update.angular.io/.
Once the angular cli is installed you are now ready to create angular application from scratch. To check the installed version of angular use below npm command.
If you get this error ‘ng not recognized as a internal or external command’ try re-installing the angular cli.
Re-installing angular cli
npm uninstall -g @angular/cli npm cache clean npm install -g @angular/cli
Use your favorite code editor to build your first angular application. I usually prefer visual studio code. You can download it here.
Create new app
Use npm command below to create new angular project using angular cli.
ng new myAngularApp
Above command will generate new angular application and download the dependencies for your project. Now it’s time to start your application. Go to the project directory myAngularApp and use below npm command.
This command will run your application locally using default port number as 4200. You can change the port number with the help of –port 5600 by appending it to the above command.
To create a production build of your application use ng build command. However, ng build creates a production build of your application in a “/dist” directory of your application folder.
You can now able to start creating your first angular application.