fix: initialize controller state softly

This commit is contained in:
Baptiste Grob
2020-05-13 17:05:04 +02:00
parent 49d8ca666d
commit b2d6ea00c8

View File

@@ -17,13 +17,13 @@ export class PureViewCtrl {
/* @ngInject */
constructor($timeout: ng.ITimeoutService) {
this.$timeout = $timeout;
/* Allow caller constructor to finish setting instance variables */
setImmediate(() => {
this.state = this.getInitialState();
});
}
$onInit() {
this.state = {
...this.getInitialState(),
...this.state,
}
this.addAppEventObserver();
this.addAppStateObserver();
}
@@ -141,4 +141,4 @@ export class PureViewCtrl {
/** Optional override */
}
}
}