Generating a New Application
Now that we have installed and configured Angular CLI, we can start generating our new application.
Running the ng new command will do the following:
Create a folder called
angular-socialCreate a new basic application inside this folder
Add a routing module (because the
--routingflag is passed in)Run
npm installinside this folder to install the dependenciesRun
git initto initialize a new Git repository
Creating a New Application
To create a new application, perform the following steps:
Open your terminal and navigate to the directory where you want to work on your application:
cd dev
Once inside your workspace directory, invoke the
ngcommand as follows:ng new angular-social --routing
The output of this command will be similar to the following:

Let's have a look at the folders that are created after running this command:
src: This folder contains the source files for our applicationsrc/app/: This folder contains the application filessrc/assets/: This folder contains the static assets we can use in our application (such as images)src/environments/: This folder contains the definition of the default environments of our applicatione2e: This folder contains the end-to-end tests for our application
Serving the Application
To serve the application, perform the following steps:
When the installation is finished, we can open our terminal and enter the working directory:
cd angular-social
Run the
ng servecommand to start the development server:ng serve
The output of the command will be as follows:

Viewing Your Application
To view your application, perform the following steps:
Open your browser and navigate to
http://localhost:4200/.You should be greeted with a default page that says Welcome to app!:

In this section, we have created a basic application using Angular CLI and viewed the same in the browser.