AngularJS:如何在HTML编译安排编制的顺序? [英] AngularJS : How does the HTML compiler arrange the order for compiling?

查看:88
本文介绍了AngularJS:如何在HTML编译安排编制的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当有多个元素的多个指令,一个页面上,如何角的HTML编译安排编制的顺序?

When there are multiple directives across multiple elements on a page, how does Angular's HTML compiler arrange the order for compiling?

说我有下面的标记,其中α,β,γ是自定义指令角,

Say I have the following markups, where alpha, beta, and gamma are custom Angular directives,

<html ng-app>
  <alpha><beta></beta></alpha>
  <gamma></gamma>
</html>

什么是编译器对他们的工作秩序?它是阿尔法=>伽马=>测试版?或者是阿尔法=>公测=>伽马?

What's the order the compiler would work on them? Is it alpha => gamma => beta? Or is it alpha => beta => gamma?

要的东西多一点复杂,考虑阿尔法指令的模板,还有一个自定义的指令,叫做foo。当富被编译?所有上述指令后会被编译?或Alpha后立即被编译?

To complicate things a little bit more, consider alpha directive's template has another custom directive, called foo. When would foo get compiled? After all of the above directives get compiled? Or right after alpha is compiled?

推荐答案

我问在AngularJS邮件列表同样的问题,彼得·培根达尔文为与演示一个的jsfiddle一个伟大的答案。 链接

I asked the same question in the AngularJS mailing list and Peter Bacon Darwin gave a great answer with a jsfiddle for demonstration. Link

这篇关于AngularJS:如何在HTML编译安排编制的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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