Skip to content

Commit

Permalink
fix(InputBase): Added changeDetector to markForCheck and update view. F…
Browse files Browse the repository at this point in the history
…ixes #90
  • Loading branch information
tonivj5 committed Sep 11, 2017
1 parent 34184c0 commit 0568fa9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/inputs/input-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { InlineBaseConfig, InlineConfig } from "../types/inline-configs";
import {
Renderer, Component, ViewChild, ElementRef, OnInit,
Injector, OnChanges, DoCheck, AfterContentInit,
AfterViewInit, AfterViewChecked, AfterContentChecked, OnDestroy, ChangeDetectionStrategy,
AfterViewInit, AfterViewChecked, AfterContentChecked,
OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef,
} from "@angular/core";
import { Subscription } from "rxjs/Subscription";
import { InlineEditorError } from "../types/inline-editor-error.interface";
Expand All @@ -22,10 +23,11 @@ export class InputBase implements OnInit, OnChanges, DoCheck,
constructor(protected injector: Injector) {
this.renderer = injector.get(Renderer);
this.service = injector.get(InlineEditorService);
this.cd = injector.get(ChangeDetectorRef);

this.onUpdateConfig(this.service.getConfig()!);

this.state = this.service.getState().clone();
this.value = this.state.getState().value;

this.subscriptions.onUpdateConfigSubcription = this.service.events.internal.onUpdateConfig.subscribe(
(config: InlineConfig) => this.onUpdateConfig(config),
Expand Down Expand Up @@ -72,6 +74,7 @@ export class InputBase implements OnInit, OnChanges, DoCheck,
public isRegexTestable = false;
public isLengthTestable = false;
protected renderer: Renderer;
protected cd: ChangeDetectorRef;
protected subscriptions: { [key: string]: Subscription } = {};


Expand Down Expand Up @@ -207,6 +210,8 @@ export class InputBase implements OnInit, OnChanges, DoCheck,

this.state = newState;

this.cd.markForCheck();

this.service.onUpdateStateOfService.emit(this.state.clone());
}

Expand Down

0 comments on commit 0568fa9

Please sign in to comment.