AngularJS中的基本概念介绍

本文详细介绍了AngularJS的关键概念,包括模版、指令、模型、域、表达式、编译器、过滤器、视图、数据绑定、控制器、依赖注入、模块和服务等内容,并解释了它们在应用程序中的作用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

此为译文,原文地址: https://docs.angularjs.org/guide/concepts

“注”的部分是我对于相关概念的理解,仅供参考

Template

模版

HTML with additional markup

含有AngularJS标记(如ng-app,ng-controller等)的HTML文档

Directives

指令

extend HTML with custom attributes and elements

用来扩展HTML功能的属性和元素

Model

模型

the data shown to the user in the view and with which the user interacts

视图中显示并且能实现人机互动的数据(注:模型,即数据模型)

Scope

context where the model is stored so that controllers, directives and expressions can access it

指定模型的存储区域,以便控制器、指令和表达式可以访问该域。

(注:Scope指定的是Model的有效区域,Scope针对的是Model)

Expressions

表达式

access variables and functions from the scope

访问来自某个域的变量和函数

Compiler

编译器

parses the template and instantiates directives and expressions

解析模版并且实例化指令和表达式


(注1:编译器编译前:HTML文档叫做Template,即模版

              编译器编译后:HTML文档叫做View,即视图

   注2:   编译器从ng-app标记处开始编译

   注3:   编译器在HTML文件在浏览器中加载时运行

Filter

过滤器

formats the value of an expression for display to the user

将表达式的值转换成特定的格式并显示给用户

View

视图

what the user sees (the DOM)

用户看到的即DOM

Data Binding

数据绑定

sync data between the model and the view

同步模型和视图间的数据



一副很能说明数据绑定的图。


Controller

控制器

the business logic behind views

视图背后的业务逻辑

Dependency Injection

引用依赖(注:依赖在这里是一个名词,而不是动词)

Creates and wires objects and functions

创建并连接对象和函数

Injector

引用容器

dependency injection container

存放引用依赖的容器

Module

模块

a container for the different parts of an app including controllers, services, filters, directives which configures the Injector

存放某个应用各个不同部分的容器,这些不同的部分包括控制器,服务,过滤器,和用于配置引用容器的指令。

Service

服务

reusable business logic independent of views

独立于视图复用业务逻辑

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值