Building Better AngularJS
1.x Apps With TypeScript
KURT WIERSMA
@KWIERSMA
+
Who am I?
From Minneapolis, MN

Work for the American Academy of Neurology

Have been developing web apps for over 15 years

Favorites: Python/Django, AngularJS, TypeScript,
C#/MVC
Agenda
TypeScript intro and getting started

AngularJS basic knowledge assumed

How to combine two great tools

App config, routes, references.ts ordering

Controllers

Services

Authentication with API’s

Authorization and routes
AWESOME, INC
PROJECT
DATE CLIENT
8/1/2015
TypeScript
A RISING STAR
http://typescriptlang.org

TypeScript lets you write JavaScript the way you
really want to.

TypeScript is a typed superset of JavaScript that
compiles to plain JavaScript.

Any browser. Any host. Any OS. Open Source.

AngularJS 2 is implemented in TypeScript
JAVASCRIPT IS VALID TYPESCRIPT
TypeScript Syntax
Features
Classes

Modules

Interfaces

Generics

Arrow Functions

References

Type Definitions

Better “this” by default
Why would you want
types?
Structure for large code bases and/or teams

Catch errors early

Provide a structured API

Tooling can provide better code completion &
refactoring
What about existing
JavaScript Libraries?
DefinitelyTyped provides TS definitions for tons of
JS libraries

JQuery, Angular, Node, Ember, Backbone, ect.

http://definitelytyped.org

You can write you own definitions easily

TSD or Typings used to manage definitions
Custom Definitions
pusher.d.ts
Useage
Getting Started
Install: 

npm install -g typescript
Compile: 

tsc --sourcemap --out js/Application.js js/
_all.ts
Tooling
CLI: grunt with grunt-ts or gulp

TSD: managing definitions for JS libraries

tsd install angular --resolve --overwrite --save
IDEs: 

WebStorm / IntelliJ (Mac & Win) [$]

Visual Studio 2012+ (Win) [$]

Visual Studio Code (Mac & Win) [Free]

Eclipse (Mac & Win) [Free]

Editors: 

Sublime [$]

Atom [Free]
TYPSCRIPT COMPILE
GruntFile.JS
AWESOME, INC
PROJECT
DATE CLIENT
4/1/2010
AngularJS
A SUPER HEROIC FRAMEWORK
APP CONFIG & ROUTES
Application.ts
CONTROLLERS
SERVICES
AUTHENTICATION WITH API’S
AUTHORIZATION & ROUTES
Application.ts
Services.js
AngularJS Tools
Debugging

Batarang

ng-inspector

AngularUI & Bootstrap UI

Testing

Protractor

ng-describe
Resources
Using Visual Studio Code with Typescript and
AngularJS

John Papa’s AngularJS Style Guide

Real World Example Apps

Angular In 20 Minutes

Expense Manager
QUESTIONS?
KURT WIERSMA (KWIERSMA@MAC.COM)
@KWIERSMA
HTTP://GITHUB.COM/KWIERSMA

Building Better AngularJS 1.X Apps With TypeScript