Skip to content

Commit

Permalink
fix(tags): fixed error "Expression has changed after it was checked" …
Browse files Browse the repository at this point in the history
…(#UIM-376) (#432)

8x
  • Loading branch information
lskramarov authored and pimenovoleg committed Mar 13, 2020
1 parent e1b3971 commit 7cb3f34
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 9 additions & 1 deletion packages/mosaic-dev/validation/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
</mc-tag-list>
</mc-form-field>

<div class="mc-form-field_error" *ngIf="reactiveForm.controls.reactiveTypeaheadValue.errors">
<div *ngIf="reactiveForm.controls.reactiveTypeaheadValue.errors?.required">error</div>
</div>

<br><br>

<button mc-button>Submit</button>
Expand All @@ -69,7 +73,6 @@
</div>
</form>


<br><br>

<form class="margin" #form="ngForm" (ngSubmit)="onSubmitTemplateForm(form)" novalidate>
Expand Down Expand Up @@ -139,6 +142,7 @@
</mc-tag-list>
</mc-form-field>


<br>
<br>

Expand Down Expand Up @@ -166,6 +170,10 @@
<br><br>

<button mc-button>Submit</button>

<div class="mc-form-field_error" *ngIf="formWithCustomValidator.controls.login.errors">
<div *ngIf="formWithCustomValidator.controls.login.errors?.required">error</div>
</div>
</form>

<div class="margin">
Expand Down
8 changes: 2 additions & 6 deletions packages/mosaic/tags/tag-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,9 @@ export class McTagList extends McTagListMixinBase implements McFormFieldControl<
// has changed after it was checked" errors from Angular.
Promise.resolve().then(() => {
this.tagChanges.emit(this.tags.toArray());

this.changeDetectorRef.markForCheck();
this.stateChanges.next();
this.propagateTagsChanges();
});

this.stateChanges.next();

this.propagateTagsChanges();
});
}

Expand Down

0 comments on commit 7cb3f34

Please sign in to comment.