Upgrading from 1.x

Angular 1 applications can be incrementally upgraded to Angular 2. This guide is still in the process of being updated to RC5 and it's samples may not work correctly. Having an existing Angular 1 application doesn't mean that we can't begin enjoying everything Angular 2 has to offer. That's because Angular 2 comes with built-in tools for migrating Angular 1 projects over to the Angular 2 platform. Some applications will be easier to upgrade than others, and there are ways in which we can make

HashLocationStrategy

Stable Class Class Overview class HashLocationStrategy { constructor(_platformLocation: PlatformLocation, _baseHref?: string) onPopState(fn: LocationChangeListener) : void getBaseHref() : string path(includeHash?: boolean) : string prepareExternalUrl(internal: string) : string pushState(state: any, title: string, path: string, queryParams: string) replaceState(state: any, title: string, path: string, queryParams: string) forward() : void back() : void } Class Descri

Data

Stable Type-alias What it does Represents the static data associated with a particular route. See Routes for more details. Interface Overview interface Data { } Interface Description exported from @angular/router/index, defined in @angular/router/src/config.ts

BaseResponseOptions

Experimental Class Class Overview class BaseResponseOptions { constructor() } Class Description Subclass of ResponseOptions, with default values. Default values: status: 200 headers: empty Headers object This class could be extended and bound to the ResponseOptions class when configuring an Injector, in order to override the default options used by Http to create Responses. Example (live demo) import {provide} from '@angular/core'; import {bootstrap} from '@angular/platform-browser

Resolve

Stable Interface What it does Indicates that class can implement to be a data provider. How to use class Backend { fetchTeam(id: string) { return 'someTeam'; } } @Injectable() class TeamResolver implements Resolve<Team> { constructor(private backend: Backend) {} resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable<any>|Promise<any>|any { return this.backend.fetchTeam(route.params.id); } } @NgModule({ imports: [

NG_ASYNC_VALIDATORS

Stable Const Variable Export export NG_ASYNC_VALIDATORS Providers for asynchronous validators to be used for FormControls in a form. Provide this using multi: true to add validators. See NG_VALIDATORS for more details. exported from @angular/forms/index defined in @angular/forms/src/validators.ts

ResponseContentType

Experimental Enum Class Overview class ResponseContentType { Text Json ArrayBuffer Blob } Class Description Define which buffer to use to store the response Class Details Text Json ArrayBuffer Blob exported from @angular/http/index, defined in @angular/http/src/enums.ts

Injector

Stable Class What it does Injector interface How to use const injector: Injector = ...; injector.get(...); Class Overview class Injector { staticTHROW_IF_NOT_FOUND : _THROW_IF_NOT_FOUND staticNULL : Injector get(token: any, notFoundValue?: any) : any } Class Description For more details, see the Dependency Injection Guide. Example const injector: Injector = ReflectiveInjector.resolveAndCreate([{provide: 'validToken', useValue: 'Value'}]); expect(injector.get('validToken')).t

SafeResourceUrl

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

Class()

Stable Function Class Export export Class(clsDef: ClassDefinition) : Type<any> Provides a way for expressing ES6 classes with parameter annotations in ES5. Basic Example var Greeter = ng.Class({ constructor: function(name) { this.name = name; }, greet: function() { alert('Hello ' + this.name + '!'); } }); is equivalent to ES6: class Greeter { constructor(name) { this.name = name; } greet() { alert('Hello ' + this.name + '!'); } } or equivalent to ES5