fix(core): detectChanges() doesn't work on detached instance

Closes #13426
Closes #13472
This commit is contained in:
Miško Hevery
2016-12-13 16:26:22 -08:00
committed by Victor Berchet
parent 6557bc34f6
commit 4d6ac9d414
3 changed files with 34 additions and 3 deletions

View File

@ -312,11 +312,16 @@ export abstract class AppView<T> {
*/
dirtyParentQueriesInternal(): void {}
internalDetectChanges(throwOnChange: boolean): void {
if (this.cdMode !== ChangeDetectorStatus.Detached) {
this.detectChanges(throwOnChange);
}
}
detectChanges(throwOnChange: boolean): void {
const s = _scope_check(this.clazz);
if (this.cdMode === ChangeDetectorStatus.Checked ||
this.cdMode === ChangeDetectorStatus.Errored ||
this.cdMode === ChangeDetectorStatus.Detached)
this.cdMode === ChangeDetectorStatus.Errored)
return;
if (this.cdMode === ChangeDetectorStatus.Destroyed) {
this.throwDestroyedError('detectChanges');