fix(upgrade): clean up scope when element is destroyed

Closes #8102
This commit is contained in:
Andrei Alecu 2016-04-16 13:46:53 +03:00
parent d094a85647
commit 0fc9ec248e
2 changed files with 5 additions and 1 deletions

View File

@ -22,6 +22,7 @@ export interface IRootScopeService {
$new(isolate?: boolean): IScope;
$id: string;
$watch(expr: any, fn?: (a1?: any, a2?: any) => void): Function;
$destroy(): any;
$apply(): any;
$apply(exp: string): any;
$apply(exp: Function): any;

View File

@ -160,7 +160,10 @@ export class DowngradeNg2ComponentAdapter {
}
registerCleanup() {
this.element.bind('$destroy', () => this.viewManager.destroyRootHostView(this.hostViewRef));
this.element.bind('$destroy', () => {
this.componentScope.$destroy();
this.viewManager.destroyRootHostView(this.hostViewRef);
});
}
}