Angular 数据不更新解决方案

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_31851435/article/details/89211335

 在组件里添加以下代码:

import { ChangeDetectorRef } from '@angular/core';

// 在需要更新数据的地方引用
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();

猜你喜欢

转载自blog.csdn.net/qq_31851435/article/details/89211335