Changing model and changing mode causes stale data
tank104 opened this issue · 2 comments
Hi,
I think there might be an issue when setting content and then switching to "preview" mode, then back to "editor" mode - the editor text has the old content until you click on editor, or change it.
<button class="btn btn-default btn-primary" *ngIf="this.mode == 'preview'" (click)="editClick()">Edit</button>
<button class="btn btn-default btn-primary" *ngIf="this.mode == 'editor'" (click)="cancelClick()">Cancel</button>
<md-editor name="Content" [(ngModel)]="content" [mode]="mode" [height]="'400px'" [options]="options" required>
ngOnInit(): void {
this.content = "123";
}
editClick() {
this.mode = "editor";
}
cancelClick() {
this.content = "xyz";
this.mode = "preview";
//setTimeout(() => {
// this.mode = "preview";
//}, 100);
}
If you click edit - it shows "123" then click cancel, then click edit again and it still shows "123" until you click on the editor then changes to "xyz".
If you uncomment the setTimeout then that fixes it.
Fixed in 3.1.2
Thanks!