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 =

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

Dependency Injection

Techniques for Dependency Injection Dependency Injection is a powerful pattern for managing code dependencies. In this cookbook we will explore many of the features of Dependency Injection (DI) in Angular. Table of contents Application-wide dependencies External module configuration @Injectable and nested service dependencies Limit service scope to a component subtree Multiple service instances (sandboxing) Qualify dependency lookup with @Optional and @Host Inject the component's DOM element De

DOCUMENT

Stable Const Variable Export export DOCUMENT A DI Token representing the main rendering context. In a browser this is the DOM Document. Note: Document might not be available in the Application Context when Application and Rendering Contexts are not the same (e.g. when running the application into a Web Worker). exported from @angular/platform-browser/index defined in @angular/platform-browser/src/dom/dom_tokens.ts

disableDebugTools()

Experimental Function Class Export export disableDebugTools() : void Disables Angular 2 tools. exported from @angular/platform-browser/index defined in @angular/platform-browser/src/browser/tools/tools.ts

DoCheck

Stable Class What it does Lifecycle hook that is called when Angular dirty checks a directive. How to use . @Component({selector: 'my-cmp', template: `...`}) class MyComponent implements DoCheck { ngDoCheck() { // ... } } Class Overview class DoCheck { ngDoCheck() : void } Class Description ngDoCheck gets called to check the changes in the directives in addition to the default algorithm. The default change detection algorithm looks for differences by comparing bound-property

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

discardPeriodicTasks()

Experimental Function Class Export export discardPeriodicTasks() : void Discard all remaining periodic tasks. exported from @angular/core/testing/index defined in @angular/core/testing/fake_async.ts

DefaultValueAccessor

Stable Directive Class Overview class DefaultValueAccessor { constructor(_renderer: Renderer, _elementRef: ElementRef) onChange : (_: any) => {} onTouched : () => {} writeValue(value: any) : void registerOnChange(fn: (_: any) => void) : void registerOnTouched(fn: () => void) : void setDisabledState(isDisabled: boolean) : void } Selectors input:not([type=checkbox])[formControlName] textarea[formControlName] input:not([type=checkbox])[formControl] textarea[for

DefaultUrlSerializer

Stable Class What it does A default implementation of the UrlSerializer. Class Overview class DefaultUrlSerializer { parse(url: string) : UrlTree serialize(tree: UrlTree) : string } Class Description Example URLs: /inbox/33(popup:compose) /inbox/33;open=true/messages/44 DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to specify route specific param