feat(UpgradeComponent): add/improve support for lifecycle hooks

Add support for the `$postDigest()` and `$onDestroy()` lifecycle hooks.
Better align the behavior of the `$onChanges()` and `$onInit()` lifecycle hooks
with Angular 1.x:

- Call `$onInit()` before pre-linking.
- Always instantiate the controller before calling `$onChanges()`.
This commit is contained in:
Georgios Kalpakas
2016-10-20 13:42:57 +03:00
committed by vikerman
parent f0cdb428f5
commit 469010ea8e
3 changed files with 793 additions and 47 deletions

View File

@ -5,10 +5,11 @@ export declare function downgradeComponent(info: ComponentInfo): angular.IInject
export declare function downgradeInjectable(token: any): (string | ((i: Injector) => any))[];
/** @experimental */
export declare class UpgradeComponent implements OnInit, OnChanges, DoCheck {
export declare class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy {
constructor(name: string, elementRef: ElementRef, injector: Injector);
ngDoCheck(): void;
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
ngOnInit(): void;
}