【发布时间】:2012-09-03 21:49:36
【问题描述】:
我正在尝试在 ng-repeat 中动态加载模板:
<ul>
<li ng-repeat="prop in entity" >
<div ng-include src="prop.template"></div>
</li>
</ul>
prop.template 等于模板的 URL,例如'partials/form/text.html'。上面的代码产生以下错误:
Error: 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [["prop.template; newVal: \"partials/form/text.html\"; oldVal: undefined","prop.template; newVal: \"partials/form/text.html\"; oldVal: undefined" .... (and so on)
如何从 prop.template 获取模板的 URL 并将该文件中的 HTML 插入到 ng-repeat 内的 DOM 中?
【问题讨论】: