Angular CLI or Command Line Interface allows you to quickly and easily start a new angular project from the command line. But before we can begin, we need to have Node.js installed on our machine.
To check whether or not you have Node.js installed on your system, type the following command at the console:
node - v
This should return with the specific version of Node.js installed on your machine. If not, you will need to install Node.js by visiting their official site.
Based on your operating system, you can download and install Node.js for your machine. The setup should also install Node Package Manager (NPM) which can enable you to install other packages.
Once you have installed Node.js, you can install Angular CLI using the following command:
npm install @angular/cli -g
The “-g” means that the Angular CLI will be installed globally and you will only have to install this once.
Once Angular CLI is installed, you can start a new angular project using the following command at your preferred location:
ng new my-first-project
Once the project is created, get inside the project folder:
Then you load the project in your browser using the following command:
This command will start a new NG Live Development Server and start listening on the port 4200 by default. You can see that the angular project is being served into the browser by typing the following URL in the URL bar: