Angular 2.0 Basics - Instalation and Setup

Overview

5 to 10 minutes to read and implement.

1) Installation of Angular 2.0 1) Setting up npm and node 1) An intitial package 1) Using nodes internal server 2) Setting up TypeScript 2) Creating our first Angular 2.0 application 3) Using a non-node.js server with Angular 2.0

This is a step-by-step guide to installing and setting up Angular 2.0 Release Candidate 1. I have pulled this together because there are far too many guides to doing this that are for Angular 2.0 beta 0 .. 17 and they all are marred with flaws. As Angular 2.0 progresses toward a full release I will keep this updated so that it reflects what is current. In a later blog post I detail what is required to get the new Angular Router to work. It has had significant changes in the last week between Beta-17 and RC1.

This borrows heavily from the "5 Min Quickstart" angular tutorial. However I will also be using a Go (golang) server for serving the Angular application. This will illustrate how to use a non-node.js server with Angular 2.0.

TypeScript prevents a lot of errors from creeping into my code. So I use it. It compiles files into JavaScript that can then be run by the browser. Angular 2.0 is written in TypeScript for good reasons. I highly recommend it. All of this blog post will assume that you are using TypeScript.

Install Node.JS and npm

If you do not already have a current Node.js® and npm then you will need to install them. The nodejs.org site has all of the details on this.

Test your install of node with

$ node
> console.log ( "hello" );
hello
undefined
> ^D

Use a control-D at the end to exit node.js.

Install TypeScript

Install typescript using the npm package manager that came with node.js.

$ npm install -g typescript

On my Linux systems this requires writing to directories that are owned by root. So I use:

$ sudo npm install -g typescript

If you want more details or find a defect in typescrip then you need to see the TypeScript NPM instalation Details page.

Create package.json and other setup files

xyzzy Tabbed-region with Code

Install with npm

xyzzy

Running Node.js Server

xyzzy


•       •       •       •       •       •

Summary: # of Words: 439
Author: Philip J. Schlump
Published On: 2016-05-20

 

Before You Go....

Have you read "Unintend Consinsequences"?

"I laughed so hard it hurt..."
    Rod Brown

"Incredibly funny! Incredibly true!"
    Tad Stevens