Angular4_控制台错误

Expression has changed after it was checked. PrevIoUs value: 'true'. Current value: 'false'.


 
 

在Component中连续多次修改一个属性值,F12页面有报这个错,找到几个解释。

Angular utilizes zones to know when an event is fully processed by patching some async APIs like (addEventHandler,setTimeout,...) and then runs change detection after each event.

In dev mode Angular does an additional change detection run,just after the first one. Because there was no event in between,no change should have happened.

If the model still changed,Angular considers this to be a possible bug.

That's exactly it. In development mode the change detection runs a second time and compares the current value with the first run.

If the value differs,then it "thinks" that the change was caused by itself. That's why it throws. However this doesn't happen in production mode with .

解决方案:


 
 


http://www.jianshu.com/p/a5402332315d
來源:简书enableProdMode()import { Component,enableProdMode } from '@angular/core'; enableProdMode();



这段代码需要写在,别忘了引用 enableProdMode

相关文章

AngularJS 是一个JavaScript 框架。它可通过 注:建议把脚本放在 元素的底部。这会提高网页加载速度,因...
angluarjs中页面初始化的时候会出现语法{{}}在页面中问题,也即是页面闪烁问题。出现这个的原因是:由于...
AngularJS 通过被称为指令的新属性来扩展 HTML。AngularJS 指令AngularJS 指令是扩展的 HTML 属性,带有...
AngularJS 使用表达式把数据绑定到 HTML。AngularJS 表达式AngularJS 表达式写在双大括号内:{{ expres...
ng-repeat 指令可以完美的显示表格。在表格中显示数据 {{ x.Name }} {{ x.Country }} 使用 CSS 样式为了...
$http是 AngularJS 中的一个核心服务,用于读取远程服务器的数据。读取 JSON 文件下是存储在web服务器上...