angular基本知识学习笔记 - Component的基本概念
官网地址:https://angular.io/guide/architecture
Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your apps.
平台和框架,用于开发SPA应用,由TypeScript开发, 我们开发的应用导入Angular的TypeScript库。
The architecture of an Angular application relies on certain fundamental concepts. The basic building blocks are NgModules, which provide a compilation context for components. NgModules collect related code into functional sets; an Angular app is defined by a set of NgModules. An app always has at least a root module that enables bootstrapping, and typically has many more feature modules.
Angular应用的基本组成部分是NgModules, 它是Component的编译上下文。一个Angular应用至少包含一个Root module,用于实现BootStrap. 除了Root module外,Angular应用包含多个feature module.
Components define views, which are sets of screen elements that Angular can choose among and modify according to your program logic and data.
Component定义了视图,是一系列screen element的集合。
Components use services, which provide specific functionality not directly related to views. Service providers can be injected into components as dependencies, making your code modular, reusable, and efficient.
Component使用Service,service provider可以通过dependencies的方式被注入,让Angular代码更加模块化,提供可重用性和执行效率。
Modules, components and services are classes that use decorators. These decorators mark their type and provide metadata that tells Angular how to use them.
Modules,Components和Services都是使用了Decorators的classes. 这些Decorators标记了三者的类型,提供了元数据,告知Angular如何使用它们。
The metadata for a component class associates it with a template that defines a view. A template combines ordinary HTML with Angular directives and binding markup that allow Angular to modify the HTML before rendering it for display.
Component类的metadata将其关联到了一个模板上,该模板定义了一个视图。此模板将普通的html同Angular的directive和绑定信息的Markup结合了起来,允许Angular在HTML渲染显示之前动态地修改它。
The metadata for a service class provides the information Angular needs to make it available to components through dependency injection (DI).
Service Class的metadata给Angular提供了足够的用于依赖注入的信息。
Components定义了若干Views,通过Router service进行navigation管理。
相关文章
- Angular: 最佳实践
- angular面试问题_kafka面试题
- 前端必读3.0:如何在 Angular 中使用SpreadJS实现导入和导出 Excel 文件
- 如何在Angular项目中使用MQTT
- Angular HTTP 请求自定义 timeout 值的一种实现思路
- Angular 里 HTTP 请求和响应结构的拦截器(interceptors)在 SAP Spartacus 中的应用
- angular入门教程_初学者织围巾简单教程慢动作
- angular面试题及答案_angular面试
- Angular Universal Application 应该处理 HTTP POST 请求吗?
- 【Angular教程】自定义管道
- Angular 项目路径添加指定的访问前缀
- Angular 项目中 angular.json builder 字段的可选项介绍
- Angular 框架将进入 2.0 时代
- angular.foreach循环方法使用指南
- angular中使用路由和$location切换视图