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 debounce throttle「建议收藏」
- 如何在Angular项目中使用MQTT
- Angular HTTPClient 发送请求的触发方式讨论
- Angular 里 HTTP 请求和响应结构的拦截器(interceptors)在 SAP Spartacus 中的应用
- 关于 Angular HttpClient 的单例特性的思考
- uat环境和生产环境的区别_angular 生产环境 相对路径无效
- Angular 14 新的 inject 函数介绍
- Angular Universal Application 应该处理 HTTP POST 请求吗?
- 【Angular教程】-组件通信|8月更文挑战
- 关于 Angular 开发时对主流浏览器支持的话题
- 关于 Angular 工程文件 angular.json 里的 inlineCritical 属性
- Angular 项目路径添加指定的访问前缀
- Angular SSR 应用启动时的一些保护措施
- Angular 应用 tsconfig.json 文件里的 typeRoots 属性讲解
- Angular 项目中 angular.json builder 字段的可选项介绍
- 关于 Angular 12 的 inlineCriticalCss 选项
- MySQL Error number: 3739; Symbol: ER_SRS_INVALID_ANGULAR_UNIT; SQLSTATE: SR002 报错 故障修复 远程处理
- Angular和jQuery的区别
- Angular与React、Vue.js的对比
- angular简介和其特点介绍