当我在垫选择元素上添加disableRipple时,我得到一个ExpressionChangedAfterItHasBeenCheckedError
我的代码:
<mat-form-field>
<mat-select [(value)]="selectedNumOption" disableRipple>
<mat-option *ngFor="let option of resultNumOptions" [value]="option">{{ option }}</mat-option>
</mat-select>
</mat-form-field>
错误:
MatOption.html:1 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'false'. Current value: 'true'.
at viewDebugError (core.es5.js:8433)
at expressionChangedAfterItHasBeenCheckedError (core.es5.js:8411)
at checkBindingNoChanges (core.es5.js:8575)
at checkNoChangesNodeInline (core.es5.js:12418)
at checkNoChangesNode (core.es5.js:12390)
at debugCheckNoChangesNode (core.es5.js:13183)
at debugCheckDirectivesFn (core.es5.js:13085)
at Object.eval [as updateDirectives] (MatOption.html:1)
at Object.debugUpdateDirectives [as updateDirectives] (core.es5.js:13067)
at checkNoChangesView (core.es5.js:12230)
删除disableRipple可行,但是为什么禁用动画会产生这种错误呢?
还有一种解决方法,可以在没有disableRiple属性的情况下禁用选择动画吗?