Angularjs 1.2:包括在重复模板 [英] Angularjs 1.2: include template in repeat

查看:182
本文介绍了Angularjs 1.2:包括在重复模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搬到angularjs的最后一个版本(1.2),现在看来,我不能包括中继模板:

http://plnkr.co/edit/K7n9sNhXe4z99VMSqTlk?p=$p$ PVIEW

我可以使用指令与templateUrl,但有什么办法,只有NG-包括做到这一点?

感谢。

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


修改

:每个重复单元上的错误日志(最新的Chrome版本)

 类型错误:无法调用空的方法'的insertBefore
    在https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:3321:22
    在的forEach(https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:199:18)
    在Object.enter(https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:3320:9)
    在https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:15947:24
    在https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:6277:11
    在wrappedCallback(https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9042:59)
    在wrappedCallback(https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9042:59)
    在https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9128:26
    在Object.Scope。$的eval(https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9953:28)
    在Object.Scope。$摘要(https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0rc1/angular.js:9809:23)


解决方案

鬼 - 长颈鹿(1.2)不是产能的释放。许多在docs.angularjs.org页面发现的jsfiddle和plunker实例不再工作,因为这些例子自动更新到1.2版本。

有很多功能更新和bug修复1.2版本,包括ngAnimate一个完全重写,但仍有许多工作就变成了稳定版本之前完成。

I am moving to the last version of angularjs (1.2), and now it seems that i cant include templates in the repeater:

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

I can use directive with templateUrl but is there a way to do this with ng-include only ?

Thanks.

Note: this works with the latest stable angularjs version (1.0.7)


EDIT: Error log (latest Chrome version) on each repeat element:

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)

解决方案

spooky-giraffe (v 1.2) is not a production release. Many of the jsfiddle and plunker examples found in the docs.angularjs.org pages no longer work since those examples auto-updated to version 1.2.

There are many feature updates and bug fixes in version 1.2, including a complete rewrite of ngAnimate, but still much work to be done before it becomes a stable release.

这篇关于Angularjs 1.2:包括在重复模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆