template 和 templateUrl Angularjs 之间的性能差异有多大 [英] How much of a performance difference is between template and templateUrl Angularjs

查看:18
本文介绍了template 和 templateUrl Angularjs 之间的性能差异有多大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

template 和 templateUrl 之间的性能差异有多大?

How much is there a performance difference between template and templateUrl?

目前我在我的所有指令中都使用模板,但因为我对性能很着迷,所以我现在想要,它更快.

Currently I am using template in all my directives, but because I am obsessed with performance, I would like to now, which is faster.

如果我使用 templateUrl + $templateCache,这是否比仅在指令中使用模板更快?

And if I use templateUrl + $templateCache, is this faster then only using template in directives?

推荐答案

这里遇到了类似的问题,chrome 开发工具(即时间轴)提供了一张不错的图片,然后被一篇不错的文章证实了 https://thinkster.io/templatecache-tutorial/

Faced kind of similar problem here and chrome dev tools (namely the Timeline) gave a nice picture which was then confirmed by a nice article https://thinkster.io/templatecache-tutorial/

区别在于$templateCache.内联模板不会命中它,而使用 templateUrl

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