yabab-dev / ng2-codemirror

Angular2 CodeMirror component
MIT License
70 stars 30 forks source link

Double ngModelChange emits #4

Closed moniuch closed 7 years ago

moniuch commented 8 years ago

I don't know whether it's a bug or by design, but I am getting double calback from ngModelChange.

While experimenting with the codemirror element suggested usage, I took the banana out of the box, as in:

<codemirror #editor [ngModel]="code" (ngModelChange)="onChanged($event)" [config]="config"></codemirror>

onChanged($event){
    console.log('onChanged', $event);
    this.codeOut = $event;
}

and I am getting double console.log on every change (keystroke or paste).