Warning - do not use this against 2.0.0-beta.0 yet. I have not spent the time to convert it over. I will do so, but I have bigger fish to fry at the moment. Take a look at any of a number of seed projects if you like, including one I just did at https://github.com/krimple/angular2-simple-ts-http-example which uses beta 0, http and observables.
This project is based on learnings from a few others, including ng2-play, the Angular Class seed projects and others.
I got frustrated with the various hoops I was jumping through by using others' repositories so I built mine from the ground up. There are a lot of moving parts, and I wanted to tease them all out. The last straw was when I heard that the Angular team was no longer pushing to DefinitelyTyped (and not using the tsd tool).
Things at play here:
- All dependencies are stored in the repo using
npm
- A gulp task (currently called setup) copies the static files over to
a set of directories in the
web
top-level directory. This includes the ES5 versions of Angular, Bootstrap, the MS Reactive JS libraries, etc... intoweb/lib
- The system uses the
gulp-typescript
transpiler plugin, which calls ontypescript
to do its' bidding. The version of TypeScript I'm using is 1.6.2. - The transpile targets ES5, outputs
.js
files inweb/js
, and expects them to be loaded by the System.JS ES5 loader. The settings for transpilation are placed intsconfig.json
so tools like Visual Studio Code and Atom can use them. This is not 100% perfect yet. - The index.html file in
web
is wiring together the application, using System.JS, the Reflect.js module loader shim, and thees6-shim
to cover any features in objects such asArray.prototype
that aren't in your current ES5 browser.
- Clone the repo
- Run the following
npm install -g gulp typescript@1.6.2 live-server
npm install
gulp setup
Just run the gulp command to fire up a server with livereload and automatic typescript compilation. Browse to http://localhost:4000
.
gulp