Create Angular project using Angular CLI

Creating an Angular Project using the Angular CLI is nothing easier. You only need (after installing Angular CLI):

  • Navigate to the directory where you want to create the Angular project
  • Open terminal in macOS, Linux or command-line in Window
  • Enter the following statement:

with project_name is the name of the Angular project, then we can create an Angular project.

For example, run the following command:

It will ask you whether you want to add the Angular Routing for your application or not?

Create Angular project using Angular CLI

Depending on your needs, please enter y or N! Here, I just created a simple project so I will enter N.

Next, it will ask us about the style sheet format you want to use, including CSS, SCSS, Sass, Less or Stylus.

Create Angular project using Angular CLI

You want to use which format, let press the up and down button to select it.

I will choose default CSS and press Enter.

The result will be:

Create Angular project using Angular CLI

At this point, if you check the directory of the Angular project, you will see the results as follows:

Create Angular project using Angular CLI

To run this project, just go to the root of the project and run the following command:

By default, Angular CLI will start our application at port 4200. So if you have access to http://localhost:4200/, you will see the following result:

Create Angular project using Angular CLI

If you try to modify the file app.component.ts in the src/app of the Angular project from:

into:

the browser will automatically refresh to:

Create Angular project using Angular CLI

Here, you can start building an Angular application.

Chia sẽ bài viết này ...Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin

Add Comment