angular2、4中数据模型改变 页面不刷新解决方案

类似于angular1里的$scope.$apply();方法  


//页面引入所需模块
import { ChangeDetectorRef } from '@angular/core';

//注入服务
constructor( public changeDetectorRef : ChangeDetectorRef ) {}

//在更改数据后不刷新的地方添加这两句话
this. changeDetectorRef. markForCheck();
this. changeDetectorRef. detectChanges();







猜你喜欢

转载自blog.csdn.net/qq_36171431/article/details/79713630