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

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


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

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

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







你可能感兴趣的:(ionic,angular)