【发布时间】:2016-12-07 23:01:27
【问题描述】:
我正在使用 Angular 学习 Meteor,但我有点被这个错误难住了。
在我的文件夹结构中:
client
|_ index.html
|_ main.html
|_ main.js
main.html 包含我想在页面上显示的模板。这是一个简单的模板。
<div ng-controller="ClassListCtrl">
test away big boy!
</div>
在 main.js 中我设置了模块:
import angular from 'angular';
import angularMeteor from 'angular-meteor';
angular.module('rpgGame', [
angularMeteor
]).controller('ClassListCtrl', function($scope){
'ngInject';
});
在 index.html 中 - 我加载应用程序,打开 ng-strict-di 并使用 ng-include 指令将 main.html 作为 div 的源:
<body ng-app="rpgGame" ng-strict-di="">
<div ng-include src="'client/main.html'"></div>
</body>
但是,正如我在标题中提到的,我明白了
达到 10 次 $digest() 迭代。中止
现在 - 我没有以任何方式修改范围,因此我不明白为什么 angular 会调用摘要更新 - 更不用说我什至没有遍历集合或更改任何集合。为什么会抛出这个错误?
从我的控制台:
Watchers fired in the last 5 iterations: [[{"msg":"fn: constantWatch","newVal":"client/main.html"}],[{"msg":"fn: constantWatch","newVal":"client/main.html"}],[{"msg":"fn: constantWatch","newVal":"client/main.html"}],[{"msg":"fn: constantWatch","newVal":"client/main.html"}],[{"msg":"fn: constantWatch","newVal":"client/main.html"}]]
【问题讨论】:
-
它必须与库而不是您的代码,看起来很好。这是在做什么 ng-strict-di="" ?
-
ng-strict-di 指令已到位,以防出现缩小问题。如果存在缩小问题,它会在开发阶段被检测到,而不仅仅是在生产中。见 www.angular-meteor.com/tutorials/socially/angular1/dynamic-template
-
我按照他们的指示到了发球台——但也重命名了我的控制器/集合......它没有用。我将它简化为问题中提出的版本 - 仍然在那里抛出错误。重启流星。甚至重新安装了我所有的包
-
你的代码在 git 上吗?
-
不——这是我昨天捡到的。现在仅限本地