ActivatedRouteSnapshot

Stable Interface What it does Contains the information about a route associated with a component loaded in an outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to traverse the router state tree. How to use @Component({templateUrl:'./my-component.html'}) class MyComponent { constructor(route: ActivatedRoute) { const id: string = route.snapshot.params.id; const url: string = route.snapshot.url.join(''); const user = route.snapshot.data.user; } }

NavigationExtras

Stable Interface What it does Represents the extra options used during navigation. Interface Overview interface NavigationExtras { relativeTo : ActivatedRoute queryParams : Params fragment : string preserveQueryParams : boolean preserveFragment : boolean skipLocationChange : boolean replaceUrl : boolean } Interface Description Interface Details relativeTo : ActivatedRoute Enables relative navigation from the current ActivatedRoute. Configuration: [{ path: 'parent', co

5. Services

We create a reusable service to manage our hero data calls Services The Tour of Heroes is evolving and we anticipate adding more components in the near future. Multiple components will need access to hero data and we don't want to copy and paste the same code over and over. Instead, we'll create a single reusable data service and learn to inject it in the components that need it. Refactoring data access to a separate service keeps the component lean and focused on supporting the view. It also m

ComponentFactory

Stable Class Class Overview class ComponentFactory { constructor(selector: string, _viewFactory: Function, _componentType: Type<any>) C selector : string componentType : Type<any> create(injector: Injector, projectableNodes?: any[][], rootSelectorOrNode?: string|any) : ComponentRef<C> } Class Description Constructor constructor(selector: string, _viewFactory: Function, _componentType: Type<any>) Class Details C selector : string componentType :

Provider

Stable Type-alias What it does Describes how the Injector should be configured. How to use See TypeProvider, ValueProvider, ClassProvider, ExistingProvider, FactoryProvider. Interface Overview interface Provider { } Interface Description For more details, see the Dependency Injection Guide. exported from @angular/core/index, defined in @angular/core/src/di/provider.ts

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

Headers

Experimental Class Class Overview class Headers { staticfromResponseHeaderString(headersString: string) : Headers constructor(headers?: Headers|{[key: string]: any}) append(name: string, value: string) : void delete(name: string) : void forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void) : void get(header: string) : string has(header: string) : boolean keys() : string[] set(header: string, value: string|string[]) : void val

TypeProvider

Stable Interface What it does Configures the Injector to return an instance of Type when `Type' is used as token. How to use @Injectable() class MyService {} const provider: TypeProvider = MyService; Interface Overview interface TypeProvider { } Interface Description Create an instance by invoking the new operator and supplying additional arguments. This form is a short form of TypeProvider; For more details, see the Dependency Injection Guide. Example @Injectable() class Greeting {

ComponentFactoryResolver

Stable Class Class Overview class ComponentFactoryResolver { staticNULL : ComponentFactoryResolver resolveComponentFactory(component: Type<T>) : ComponentFactory<T> } Class Description Static Members NULL : ComponentFactoryResolver Class Details resolveComponentFactory(component: Type<T>) : ComponentFactory<T> exported from @angular/core/index, defined in @angular/core/src/linker/component_factory_resolver.ts

ReactiveFormsModule

Stable Class Class Overview class ReactiveFormsModule { } Class Description The ng module for reactive forms. Annotations @NgModule({ declarations: [REACTIVE_DRIVEN_DIRECTIVES], providers: [FormBuilder, RadioControlRegistry], exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES] }) exported from @angular/forms/index, defined in @angular/forms/src/form_providers.ts