Just playing around with Angular2
JavaScript TypeScript HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
01-basics
02-displaying_data
03-user_input
04-making_components
typings
README.md
index.html
tsconfig.json

README.md

angular2-playground

Angular 2 tutorials and what not.

Sources

Large Angular2 Education Link Farm (timjacobi)

Each example in this repository is built from these sources:

Getting Code

$ git clone https://github.com/mitch-b/angular2-playground
$ cd angular2-playground/

Environment Setup

(this is assuming node and npm are already installed)

# install toolsets and dependencies
$ npm i -g tsd@latest
$ tsd install angular2 es6-promise rx rx-lite
$ npm i -g typescript@^1.5.0-beta

Option 0: Use terminal

Mac/Linux

$ tsc --watch

Windows

> tsc.cmd -w

Option 1: Use Atom + atom-typescript

I've found Atom to be fairly simple to use. With the atom-typescript package, it will compile the .ts files to .js every time you save your file. Convenient.

Option 2: Visual Studio Code

I also tested these samples using Visual Studio Code. Seems to work pretty straightforward and was built to handle TypeScript.

  1. Open this repo folder in VS Code
  2. Ctrl+Shift+B (Windows/Linux), ⌘+Shift+B (Mac) will trigger build using tsc settings found in .settings/tasks.json

See TypeScript features in VS Code on MSDN

Ubuntu Notes

When trying this on a clean installation of Ubuntu 15.04, there's may be small changes you'll want to make.

Depending on how you've got node installed, you either have or don't have the node executable alias. Make sure node executable can be found, since our VSCode build task expects the name node. Installing node from apt-get doesn't seem to include this.

Running Ctrl+Shift+B and inspecting the Output window, I saw this message: /usr/bin/env node No such file or directory.

So, let's fix the missing node link.

$ which node
# if you see an entry returned, you don't have this error. Go to VSCode and enjoy!

# ... if nothing, try nodejs
$ which nodejs

# if nodejs is returned, (assuming /usr/bin/nodejs) link it to node
$ ln -s /usr/bin/nodejs /usr/bin/node

Running

Use your favorite web server. Example with Python,

# pwd: /path/to/angular2-playground
$ python -m SimpleHTTPServer 11337

Now, just navigate your browser to localhost:11337