Response

Experimental Class Class Overview class Response { constructor(responseOptions: ResponseOptions) type : ResponseType ok : boolean url : string status : number statusText : string bytesLoaded : number totalBytes : number headers : Headers toString() : string } Class Description Creates Response instances from provided values. Though this object isn't usually instantiated by end-users, it is the primary object interacted with when it comes time to add data to a view

RouterLinkActive

Stable Directive What it does Lets you add a CSS class to an element when the link's route becomes active. How to use <a [routerLink]='/user/bob' routerLinkActive='active-link'>Bob</a> Class Overview class RouterLinkActive { constructor(router: Router, element: ElementRef, renderer: Renderer) links : QueryList<RouterLink> linksWithHrefs : QueryList<RouterLinkWithHref> routerLinkActiveOptions : {exact: boolean} ngAfterContentInit() : void routerL

4. User Input

User input triggers DOM events. We listen to those events with event bindings that funnel updated values back into our components and models. When the user clicks a link, pushes a button, or enters text we want to know about it. These user actions all raise DOM events. In this chapter we learn to bind to those events using the Angular event binding syntax. Run the live example. Binding to user input events We can use Angular event bindings to respond to any DOM event. The syntax is simple. We s

provideRoutes()

Stable Function What it does Registers routes. How to use @NgModule({ imports: [RouterModule.forChild(ROUTES)], providers: [provideRoutes(EXTRA_ROUTES)] }) class MyNgModule {} Class Export export provideRoutes(routes: Routes) : any exported from @angular/router/index defined in @angular/router/src/router_module.ts

OnInit

Stable Class What it does Lifecycle hook that is called after data-bound properties of a directive are initialized. How to use . @Component({selector: 'my-cmp', template: `...`}) class MyComponent implements OnInit { ngOnInit() { // ... } } Class Overview class OnInit { ngOnInit() : void } Class Description ngOnInit is called right after the directive's data-bound properties have been checked for the first time, and before any of its children have been checked. It is invoked

SafeScript

Stable Interface Interface Overview interface SafeScript { } Interface Description Marker interface for a value that's safe to use as JavaScript. exported from @angular/platform-browser/index, defined in @angular/platform-browser/src/security/dom_sanitization_service.ts

Route

Stable Interface Interface Overview interface Route { path : string pathMatch : string component : Type<any> redirectTo : string outlet : string canActivate : any[] canActivateChild : any[] canDeactivate : any[] canLoad : any[] data : Data resolve : ResolveData children : Route[] loadChildren : LoadChildren } Interface Description See Routes for more details. Interface Details path : string pathMatch : string component : Type<any> redirectTo : str

Testing

Techniques and practices for testing an Angular 2 app This chapter offers tips and techniques for testing Angular applications. Along the way you will learn some general testing principles and techniques but the focus is on Angular testing. Contents Introduction to Angular Testing Setup The first karma test The Angular Testing Platform (ATP) The sample application and its tests A simple component test Test a component with a service dependency Test a component with an async service Test a comp

wtfStartTimeRange

Experimental Const Variable Export export wtfStartTimeRange Used to mark Async start. Async are similar to scope but they don't have to be strictly nested. The return value is used in the call to [endAsync]. Async ranges only work if WTF has been enabled. someMethod() { var s = wtfStartTimeRange('HTTP:GET', 'some.url'); var future = new Future.delay(5).then((_) { wtfEndTimeRange(s); }); } exported from @angular/core/index defined in @angular/core/src/profile/profile.ts

AnimationDriver

Experimental Class Class Overview class AnimationDriver { staticNOOP : AnimationDriver animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number, easing: string) : AnimationPlayer } Class Description Static Members NOOP : AnimationDriver Class Details animate(element: any, startingStyles: AnimationStyles, keyframes: AnimationKeyframe[], duration: number, delay: number, easing: string) : AnimationPlayer exported from @ang