1. Introduction

The Tour of Heroes tutorial takes us through the steps of creating an Angular application in TypeScript. Tour of Heroes: the vision Our grand plan is to build an app to help a staffing agency manage its stable of heroes. Even heroes need to find work. Of course we'll only make a little progress in this tutorial. What we do build will have many of the features we expect to find in a full-blown, data-driven application: acquiring and displaying a list of heroes, editing a selected hero's detail,

ClientMessageBroker

Experimental Class Class Overview class ClientMessageBroker { runOnService(args: UiArguments, returnType: Type<any>) : Promise<any> } Class Description Class Details runOnService(args: UiArguments, returnType: Type<any>) : Promise<any> exported from @angular/platform-webworker/index, defined in @angular/platform-webworker/src/web_workers/shared/client_message_broker.ts

Attribute

Stable Interface Interface Overview interface Attribute { attributeName : string } Interface Description Attribute decorator and metadata. Interface Details attributeName : string exported from @angular/core/index, defined in @angular/core/src/metadata/di.ts

JsonPipe

Stable Pipe What it does Converts value into JSON string. How to use expression | json NgModuleCommonModule Description Converts value into string using JSON.stringify. Useful for debugging. Example @Component({ selector: 'json-pipe', template: `<div> <p>Without JSON pipe:</p> <pre>{{object}}</pre> <p>With JSON pipe:</p> <pre>{{object | json}}</pre> </div>` }) export class JsonPipeComponent { object: Ob

destroyPlatform()

Experimental Function Class Export export destroyPlatform() : void Destroy the existing platform. exported from @angular/core/index defined in @angular/core/src/application_ref.ts

ErrorHandler

Stable Class Class Overview class ErrorHandler { constructor(rethrowError?: boolean) handleError(error: any) : void } Class Description Provides a hook for centralized exception handling. The default implementation of ErrorHandler prints error messages to the Console. To intercept error handling, write a custom exception handler that replaces this default as appropriate for your app. Example class MyErrorHandler implements ErrorHandler { call(error, stackTrace = null, reason =

RenderComponentType

Experimental Class Class Overview class RenderComponentType { constructor(id: string, templateUrl: string, slotCount: number, encapsulation: ViewEncapsulation, styles: Array<string|any[]>, animations: {[key: string]: Function}) id : string templateUrl : string slotCount : number encapsulation : ViewEncapsulation styles : Array<string|any[]> animations : {[key: string]: Function} } Class Description Constructor constructor(id: string, templateUrl: string, slo

inject()

Stable Function Class Export export inject(tokens: any[], fn: Function) : () => any Allows injecting dependencies in beforeEach() and it(). Example: beforeEach(inject([Dependency, AClass], (dep, object) => { // some code that uses `dep` and `object` // ... })); it('...', inject([AClass], (object) => { object.doSomething(); expect(...); }) Notes: inject is currently a function because of some Traceur limitation the syntax should eventually becomes it('...', @Inject (object:

AnimationTransitionEvent

Experimental Class Class Overview class AnimationTransitionEvent { constructor({fromState, toState, totalTime}: {fromState: string, toState: string, totalTime: number}) fromState : string toState : string totalTime : number } Class Description Constructor constructor({fromState, toState, totalTime}: {fromState: string, toState: string, totalTime: number}) Class Details fromState : string toState : string totalTime : number exported from @ang

EventEmitter

Stable Class Class Overview class EventEmitter { constructor(isAsync?: boolean) emit(value?: T) subscribe(generatorOrNext?: any, error?: any, complete?: any) : any } Class Description Use by directives and components to emit custom Events. Examples In the following example, Zippy alternatively emits open and close events when its title gets clicked: @Component({ selector: 'zippy', template: ` <div class="zippy"> <div (click)="toggle()">Toggle</div>