First Application

Reference from Angular Quick Start

Angular CLI

Overview

he Angular CLI is a tool to initialize, develop, scaffold and maintain Angular applications.

Getting Started

To install the Angular CLI:

1
npm install -g @angular/cli

Generating and serving an Angular project via a development server Create and run a new project:

1
2
3
ng new my-project
cd my-project
ng serve

Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Bundling

All builds make use of bundling, and using the --prod flag in ng build --prod or ng serve --prod will also make use of uglifying and tree-shaking functionality.

Running unit tests

1
ng test

Tests will execute after a build is executed via Karma, and it will automatically watch your files for changes. You can run tests a single time via --watch=false or --single-run.

Running end-to-end tests

1
ng e2e

Before running the tests make sure you are serving the app via ng serve. End-to-end tests are run via Protractor.

Create First app

You need to install NodeJS first, then you could run the command as below:

1
2
3
4
5
6
npm install -g @angular/cli
mkdir Angular
cd Angular
ng new my-app
cd my-app
ng serve --open

Then you are good to go! Hope you enjoy the Angular World.

Author: Zhengyang Wu
Link: https://vincewu.net/2018/08/23/Angular/Angular-3-First-Application/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.