【问题标题】:Angularjs 1.2: include template in repeatAngularjs 1.2:在重复中包含模板
【发布时间】:2013-08-19 01:41:15
【问题描述】:

我正在移动到 angularjs (1.2) 的最后一个版本,现在我似乎无法在转发器中包含模板:

http://plnkr.co/edit/K7n9sNhXe4z99VMSqTlk?p=preview

我可以将指令与 templateUrl 一起使用,但有没有办法仅使用 ng-include 来做到这一点?

谢谢。

注意:这适用于最新的稳定 angularjs 版本 (1.0.7)


编辑:每个重复元素的错误日志(最新的 Chrome 版本):

TypeError: Cannot call method 'insertBefore' of null
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:3321:22
    at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:199:18)
    at Object.enter (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:3320:9)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:15947:24
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:6277:11
    at wrappedCallback (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9042:59)
    at wrappedCallback (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9042:59)
    at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9128:26
    at Object.Scope.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9953:28)
    at Object.Scope.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9809:23)

【问题讨论】:

  • 它看起来像一个错误,请提交错误报告。
  • @sza: 用错误日志编辑。
  • 我没有看到您发布的错误,但我看到渲染不起作用。我认为这是一个错误。
  • 新文档中有一个完整的部分包含所有关于可信来源的内容。这很复杂。 code.angularjs.org/1.2.0rc1/docs/api/ng.$sce
  • 好的,尝试禁用服务 (plnkr.co/edit/brpArc?p=preview) 但还是不行。

标签: angularjs angularjs-ng-repeat angularjs-ng-include


【解决方案1】:

spooky-giraffe (v 1.2) 不是生产版本。 docs.angularjs.org 页面中的许多 jsfiddle 和 plunker 示例不再有效,因为这些示例自动更新到 1.2 版。

1.2 版中有许多功能更新和错误修复,包括对 ngAnimate 的完全重写,但在它成为稳定版本之前还有很多工作要做。

【讨论】:

  • 好吧,我会坚持使用 1.0.7。
【解决方案2】:

这将在 Angular 的下一个版本中起作用。

我克隆了frameowkr,打包后添加到plnkr,给你:
http://plnkr.co/edit/k6P4Yv19bUV0BC4VBL69?p=preview

恢复重大更改的 PR:
https://github.com/angular/angular.js/pull/3640

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-11-02
    • 2015-12-17
    • 1970-01-01
    • 2012-11-18
    • 1970-01-01
    • 2015-01-20
    • 2014-04-15
    • 1970-01-01
    相关资源
    最近更新 更多