Reference

Angular Reference

Angular

Note: This is a quick-reference guide for Angular 2. It's not meant to be a comprehensive tutorial or documentation.

Getting Started: The Angular CLI

The easiest way to get an Angular app up and running is to install and use the Angular CLI.

To install the Angular CLI globally, first make sure you're running Node version 8.9 or greater. Then enter this in the command line:

npm install ‑g @angular/cli

Creating a New App

cd into the directory where you want to create your new app. Then enter:

ng new your‑project‑name

If you want to use SCSS instead of CSS, you can set that project-wide when you create a new app by adding the ‑‑style=scss flag:

ng new your‑project‑name ‑‑style=scss

Starting the App

cd into the project directory. Then enter:

ng serve ‑‑open

The ‑‑open flag opens the app in your default browser and will watch for changes. The app will be served on port 4200, which is Angular's default port. You can change the port by specifying it with the ‑‑port flag:

ng serve ‑‑port 4201

Now the app will open on port 4201.