Fix change-detection on Safari/IE

This commit is contained in:
Roman Hotsiy 2016-03-27 20:17:28 +03:00
parent a23008e839
commit b6a711b25d
2 changed files with 7 additions and 9 deletions

View File

@ -40,7 +40,7 @@ export default class JsonSchemaLazy {
this.dcl.loadNextToLocation(JsonSchema, this.elementRef).then((compRef) => {
compRef.instance.pointer = this.pointer;
// trigger change detection
compRef.location.internalElement.parentView.changeDetector.detectChanges();
compRef.hostView.changeDetectorRef.detectChanges();
});
}
this.loaded = true;

View File

@ -1,6 +1,6 @@
'use strict';
import {NgZone, ChangeDetectionStrategy, ElementRef} from 'angular2/core';
import {ChangeDetectorRef, ChangeDetectionStrategy, ElementRef} from 'angular2/core';
import {document} from 'angular2/src/facade/browser';
import {BrowserDomAdapter} from 'angular2/platform/browser';
import {global} from 'angular2/src/facade/lang';
@ -28,19 +28,16 @@ const INVIEW_POSITION = {
changeDetection: ChangeDetectionStrategy.Default
})
@Reflect.metadata('parameters', [[SchemaManager], [ElementRef],
[BrowserDomAdapter], [NgZone], OptionsManager])
[BrowserDomAdapter], [ChangeDetectorRef], [OptionsManager]])
export default class SideMenu extends BaseComponent {
constructor(schemaMgr, elementRef, dom, zone, optionsMgr) {
constructor(schemaMgr, elementRef, dom, changeDetectorRef, optionsMgr) {
super(schemaMgr);
this.$element = elementRef.nativeElement;
this.changeDetector = changeDetectorRef;
this.dom = dom;
this.options = optionsMgr.options;
this.$scrollParent = this.options.$scrollParent;
// for some reason constructor is not run inside zone
// as workaround running it manually
zone.run(() => {
this.bindEvents();
});
this.bindEvents();
this.activeCatIdx = 0;
this.activeMethodIdx = -1;
this.prevOffsetY = null;
@ -221,6 +218,7 @@ export default class SideMenu extends BaseComponent {
}
stable = true;
}
this.changeDetector.detectChanges();
}
prepareModel() {