Add interface to refer to the $onChanges parameter (#10803)

The $onChanges method of the IComponentController interface has the type in-lined, making it impossible to refer to it. A new interface was added to encapsulate this type, so that it can be easily used and extended.
This commit is contained in:
DanielM
2016-08-30 00:25:10 +09:00
committed by Masahiro Wakame
parent a50f64c12c
commit dc77ccd8e1
+7 -3
View File
@@ -1746,12 +1746,12 @@ declare namespace angular {
*/
$onInit?(): void;
/**
* Called whenever one-way bindings are updated. The changesObj is a hash whose keys are the names of the bound
* properties that have changed, and the values are an {@link IChangesObject} object of the form
* Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound
* properties that have changed, and the values are an {@link IChangesObject} object of the form
* { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as
* cloning the bound value to prevent accidental mutation of the outer value.
*/
$onChanges?(changesObj: {[property:string]: IChangesObject}): void;
$onChanges?(onChangesObj: IOnChangesObject): void;
/**
* Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources,
* watches and event handlers.
@@ -1767,6 +1767,10 @@ declare namespace angular {
*/
$postLink?(): void;
}
interface IOnChangesObject {
[property: string]: IChangesObject;
}
interface IChangesObject {
currentValue: any;