翻译自Angular官网。
What Is Angular?
什么是Angular?
AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly. Angular's data binding and dependency injection eliminate much of the code you would otherwise have to write. And it all happens within the browser, making it an ideal partner with any server technology.
AngularJS 是为动态Web应用准备的一个结构化框架。它允许你使用HTML作为你的模板语言,同时允许你扩展HTML的语法以清晰而简练地描述你应用中的各种组件。Angular的【数据绑定】以及【依赖注入】让你省下了原本需要撰写的大多数代码。尤其是它完全在浏览器内部进行,因此可以理想地与任何服务器技术相结合。
Angular is what HTML would have been, had it been designed for applications. HTML is a great declarative language for static documents. It does not contain much in the way of creating applications, and as a result building web applications is an exercise in what do I have to do to trick the browser into doing what I want?
如果HTML当初是为应用而设计的,现在它一定长得像Angular。HTML非常适合用于描述静态文档。而在应用设计方面HTML却没有什么内涵,后果就是让Web应用开发变成了一种“怎样让浏览器听俺使唤”的重复劳动。
The impedance mismatch between dynamic applications and static documents is often solved with:
这种动态应用和静态文档之间的阻抗不匹配,常常通过以下方式解决:
a library - a collection of functions which are useful when writing web apps. Your code is in charge and it calls into the library when it sees fit. E.g., jQuery.
一个库 - 一堆对于开发Web应用有用的函数。你的代码主持大局,什么时候需要什么时候调用库函数。比如jQuery。
frameworks - a particular implementation of a web application, where your code fills in the details. The framework is in charge and it calls into your code when it needs something app specific. E.g., durandal, ember, etc.
各种框架 - 框架是Web应用的一种特定实现,你的代码负责在里面补充细节。框架主持大局,遇到与应用相关的细节的时候调用你的代码。这类的例子有durandal,ember,等等。
Angular takes another approach. It attempts to minimize the impedance mismatch between document centric HTML and what an application needs by creating new HTML constructs. Angular teaches the browser new syntax through a construct we call directives. Examples include:
然而Angular另辟蹊径。它费尽心机,令以文档为中心的HTML,和应用程序通过创建新HTML结构以完成的那些需求,之间的阻抗实现尽量匹配。Angular通过一种我们叫做directive的构造来让浏览器掌握新的语法。
Data binding, as in pw_.
数据绑定用花括号实现。
DOM control structures for repeating, showing and hiding DOM fragments.
DOM控制结构可以实现重复、显示以及隐藏DOM片段。
Support for forms and form validation.
支持表单以及表单验证。
Attaching new behavior to DOM elements, such as DOM event handling.
给DOM元素增添新的行为,比如DOM事件处理。
Grouping of HTML into reusable components.
将HTML打包成可以重用的组件。