微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Angular内部对template的处理学习笔记

https://blog.angular-university.io/angular-2-what-is-unidirectional-data-flow-development-mode/

How does Angular use the template to display the data of the screen, what is going on under the hood?

Clearly Angular is not handling the template simply as a string.

Angular绝不仅仅是将template当成一个string来处理。

It’s actually quite simple: Angular is taking the data and it’s applying it a function. The output of that function is the DOM data structure that corresponds to this HTML template.

Angular执行template function,该function的输出是DOM数据结构,同HTML template一致。

Angular is not generating HTML as a string, its generating DOM data structures directly.

For example, in our case Angular will generate the DOM data structure directly from the data via a component renderer.

If the application would be a native mobile application or a server-side application then the output of the renderer would be something else. But in this case, the output of the component renderer is the DOM tree that represents the component view.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐