ExtraOptions

Stable Interface What it does Represents options to configure the router. Interface Overview interface ExtraOptions { enableTracing : boolean useHash : boolean initialNavigation : boolean errorHandler : ErrorHandler } Interface Description Interface Details enableTracing : boolean Makes the router log all its internal events to the console. useHash : boolean Enables the location strategy that uses the URL fragment instead of the history API. initialNavigation : boolean Disabl

EventManager

Stable Class Class Overview class EventManager { constructor(plugins: EventManagerPlugin[], _zone: NgZone) addEventListener(element: HTMLElement, eventName: string, handler: Function) : Function addGlobalEventListener(target: string, eventName: string, handler: Function) : Function getZone() : NgZone } Class Description Annotations @Injectable() Constructor constructor(plugins: EventManagerPlugin[], _zone: NgZone) Class Details addEventListener(element: HTMLElement, event

FactoryProvider

Stable Interface What it does Configures the Injector to return a value by invoking a useFactory function. How to use function serviceFactory() { ... } const provider: FactoryProvider = {provide: 'someToken', useFactory: serviceFactory, deps: []}; Interface Overview interface FactoryProvider { provide : any useFactory : Function deps : any[] multi : boolean } Interface Description For more details, see the Dependency Injection Guide. Example const Location = new OpaqueToken('

fakeAsync()

Experimental Function Class Export export fakeAsync(fn: Function) : args: any[]) => any Wraps a function to be executed in the fakeAsync zone: microtasks are manually executed by calling flushMicrotasks(), timers are synchronous, tick() simulates the asynchronous passage of time. If there are any pending timers at the end of the function, an exception will be thrown. Can be used to wrap inject() calls. Example describe('this test', () => { it('looks async but is synchronous', <any

ExistingProvider

Stable Interface What it does Configures the Injector to return a value of another useExisting token. How to use const provider: ExistingProvider = {provide: 'someToken', useExisting: 'someOtherToken'}; Interface Overview interface ExistingProvider { provide : any useExisting : any multi : boolean } Interface Description For more details, see the Dependency Injection Guide. Example class Greeting { salutation = 'Hello'; } class FormalGreeting extends Greeting { salutation =

Dynamic Forms

Render dynamic forms with FormGroup We can't always justify the cost and time to build handcrafted forms, especially if we'll need a great number of them, they're similar to each other, and they change frequently to meet rapidly changing business and regulatory requirements. It may be more economical to create the forms dynamically, based on metadata that describe the business object model. In this cookbook we show how to use formGroup to dynamically render a simple form with different control

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 =

enableProdMode()

Stable Function Class Export export enableProdMode() : void Disable Angular's development mode, which turns off assertions and other checks within the framework. One important assertion this disables verifies that a change detection pass does not result in additional changes to any bindings (also known as unidirectional data flow). exported from @angular/core/index defined in @angular/core/src/application_ref.ts

ElementRef

Stable Security Risk Class Security Risk Permitting direct access to the DOM can make your application more vulnerable to XSS attacks. Carefully review any use of ElementRef in your code. For more detail, see the Security Guide. Class Overview class ElementRef { constructor(nativeElement: any) nativeElement : any } Class Description Constructor constructor(nativeElement: any) Class Details nativeElement : any The underlying native element or null if direct access to native e

EmbeddedViewRef

Experimental Class Class Overview class EmbeddedViewRef { C context : C rootNodes : any[] destroy() : void } Class Description Represents an Angular View. A View is a fundamental building block of the application UI. It is the smallest grouping of Elements which are created and destroyed together. Properties of elements in a View can change, but the structure (number and order) of elements in a View cannot. Changing the structure of Elements can only be done by inserting, moving