diff --git a/modules/angular2/src/core/change_detection.ts b/modules/angular2/src/core/change_detection.ts index b131dcfb6685..47b7c7812f45 100644 --- a/modules/angular2/src/core/change_detection.ts +++ b/modules/angular2/src/core/change_detection.ts @@ -15,6 +15,7 @@ export { ChangeDetectorRef, WrappedValue, + SimpleChange, PipeTransform, PipeOnDestroy, IterableDiffers, @@ -23,5 +24,4 @@ export { KeyValueDiffers, KeyValueDiffer, KeyValueDifferFactory - } from './change_detection/change_detection'; diff --git a/modules/angular2/src/core/change_detection/change_detection.ts b/modules/angular2/src/core/change_detection/change_detection.ts index 27336b5c0cec..594711730cf4 100644 --- a/modules/angular2/src/core/change_detection/change_detection.ts +++ b/modules/angular2/src/core/change_detection/change_detection.ts @@ -51,7 +51,7 @@ export {ChangeDetectorRef} from './change_detector_ref'; export {IterableDiffers, IterableDiffer, IterableDifferFactory} from './differs/iterable_differs'; export {KeyValueDiffers, KeyValueDiffer, KeyValueDifferFactory} from './differs/keyvalue_differs'; export {PipeTransform, PipeOnDestroy} from './pipe_transform'; -export {WrappedValue} from './change_detection_util'; +export {WrappedValue, SimpleChange} from './change_detection_util'; /** * Structural diffing for `Object`s and `Map`s. diff --git a/modules/angular2/src/core/compiler/interfaces.ts b/modules/angular2/src/core/compiler/interfaces.ts index 141e483c333c..7c26874790ed 100644 --- a/modules/angular2/src/core/compiler/interfaces.ts +++ b/modules/angular2/src/core/compiler/interfaces.ts @@ -1,4 +1,5 @@ import {StringMap, MapWrapper} from 'angular2/src/core/facade/collection'; +import {SimpleChange} from 'angular2/src/core/change_detection/change_detection_util'; export enum LifecycleHooks { OnInit, @@ -60,7 +61,7 @@ export var LIFECYCLE_HOOKS_VALUES = [ * } * ``` */ -export interface OnChanges { onChanges(changes: StringMap); } +export interface OnChanges { onChanges(changes: StringMap); } /** * Notify a directive when it has been checked the first time. diff --git a/modules/angular2/src/core/forms/directives/ng_control_name.ts b/modules/angular2/src/core/forms/directives/ng_control_name.ts index ccd39258d9f3..fa6ed854fede 100644 --- a/modules/angular2/src/core/forms/directives/ng_control_name.ts +++ b/modules/angular2/src/core/forms/directives/ng_control_name.ts @@ -2,6 +2,7 @@ import {CONST_EXPR} from 'angular2/src/core/facade/lang'; import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; import {StringMap} from 'angular2/src/core/facade/collection'; import {OnChanges, OnDestroy} from 'angular2/lifecycle_hooks'; +import {SimpleChange} from 'angular2/src/core/change_detection'; import {Query, Directive} from 'angular2/src/core/metadata'; import {forwardRef, Host, SkipSelf, Binding, Inject, Optional} from 'angular2/src/core/di'; @@ -93,7 +94,7 @@ export class NgControlName extends NgControl implements OnChanges, this.validators = validators; } - onChanges(changes: StringMap) { + onChanges(changes: StringMap) { if (!this._added) { this.formDirective.addControl(this); this._added = true; diff --git a/modules/angular2/src/core/forms/directives/ng_form_control.ts b/modules/angular2/src/core/forms/directives/ng_form_control.ts index ee67f7b12800..92d7318b0f58 100644 --- a/modules/angular2/src/core/forms/directives/ng_form_control.ts +++ b/modules/angular2/src/core/forms/directives/ng_form_control.ts @@ -1,6 +1,7 @@ import {CONST_EXPR} from 'angular2/src/core/facade/lang'; import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; import {OnChanges} from 'angular2/lifecycle_hooks'; +import {SimpleChange} from 'angular2/src/core/change_detection'; import {Query, Directive} from 'angular2/src/core/metadata'; import {forwardRef, Binding, Inject, Optional} from 'angular2/src/core/di'; import {NgControl} from './ng_control'; @@ -66,7 +67,7 @@ export class NgFormControl extends NgControl implements OnChanges { this.validators = validators; } - onChanges(changes: StringMap): void { + onChanges(changes: StringMap): void { if (!this._added) { setUpControl(this.form, this); this.form.updateValidity(); diff --git a/modules/angular2/src/core/forms/directives/ng_model.ts b/modules/angular2/src/core/forms/directives/ng_model.ts index 3e125798e222..510933605367 100644 --- a/modules/angular2/src/core/forms/directives/ng_model.ts +++ b/modules/angular2/src/core/forms/directives/ng_model.ts @@ -1,8 +1,7 @@ import {CONST_EXPR} from 'angular2/src/core/facade/lang'; import {EventEmitter, ObservableWrapper} from 'angular2/src/core/facade/async'; - import {OnChanges} from 'angular2/lifecycle_hooks'; - +import {SimpleChange} from 'angular2/src/core/change_detection'; import {Query, Directive} from 'angular2/src/core/metadata'; import {forwardRef, Binding, Inject, Optional} from 'angular2/src/core/di'; import {NgControl} from './ng_control'; @@ -47,7 +46,7 @@ export class NgModel extends NgControl implements OnChanges { this.validators = validators; } - onChanges(changes: StringMap) { + onChanges(changes: StringMap) { if (!this._added) { setUpControl(this._control, this); this._control.updateValidity(); diff --git a/modules/angular2/test/compiler/runtime_metadata_spec.ts b/modules/angular2/test/compiler/runtime_metadata_spec.ts index b3c3a7077651..bf9621fd5976 100644 --- a/modules/angular2/test/compiler/runtime_metadata_spec.ts +++ b/modules/angular2/test/compiler/runtime_metadata_spec.ts @@ -29,7 +29,8 @@ import { AfterContentInit, AfterContentChecked, AfterViewInit, - AfterViewChecked + AfterViewChecked, + SimpleChange } from 'angular2/core'; import {TEST_BINDINGS} from './test_bindings'; @@ -114,7 +115,7 @@ class DirectiveWithoutModuleId { class ComponentWithEverything implements OnChanges, OnInit, DoCheck, OnDestroy, AfterContentInit, AfterContentChecked, AfterViewInit, AfterViewChecked { - onChanges(changes: StringMap): void {} + onChanges(changes: StringMap): void {} onInit(): void {} doCheck(): void {} onDestroy(): void {} diff --git a/modules/angular2/test/public_api_spec.ts b/modules/angular2/test/public_api_spec.ts index 23665ca3ac3f..5a54cd909d38 100644 --- a/modules/angular2/test/public_api_spec.ts +++ b/modules/angular2/test/public_api_spec.ts @@ -970,6 +970,12 @@ var NG_API = [ 'SlicePipe', 'SlicePipe.supports()', 'SlicePipe.transform()', + 'SimpleChange', + 'SimpleChange.currentValue', + 'SimpleChange.currentValue=', + 'SimpleChange.previousValue', + 'SimpleChange.previousValue=', + 'SimpleChange.isFirstChange()', 'TemplateRef', 'TemplateRef.elementRef', 'TemplateRef.elementRef=',